Use nested functions as callbacks with Windows API functions?
Boris-Barboris
ismailsiege at gmail.com
Mon Oct 1 21:03:24 UTC 2018
On Monday, 1 October 2018 at 20:27:43 UTC, spikespaz wrote:
> I was hoping I could use something more akin to JavaScript's
> syntax: (void* hWnd, long) => {}.
>
> I tried this but I'm getting errors with the signature, it says
> the function is a delegate and apparently Windows API can't
> accept a delegate.
You can make it a non-delegate by passing a pointer to hWndList
in lParams as it was supposed to by WinApi devs, instead of zero,
and not implicitly capturing stack pointer by referencing
hWndList directly from the body.
https://run.dlang.io/is/t4k4Nc
More information about the Digitalmars-d-learn
mailing list