amazing function behavior

Zarathustra adam.chrapkowski at
Mon Oct 19 05:16:38 PDT 2009

Daniel Keep Wrote:

> It shouldn't even COMPILE.
> You can't use member functions as Windows callbacks.  You haven't even
> used the correct calling convention on it.
> Callbacks for Win API functions have to be, I believe, extern(Windows),
> and they have to be free functions or static members.

My callback wndProc IS static, global function.
.wndProc = window.wndProc which is static, and non-member
wndClass.wndProc       = cast(ptr)&.wndProc; // .wndProc not wndProc
pointer to Window object is pass to window.wndProc in additional bytes.
My question relates to something completely different.
this.onButtonDown(l_mea) // problematic call
return (cast(Window*)user32.getWindowLong(o_hwnd, 0x00)).wndProc(o_hwnd, o_msg, o_wparam, o_lparam);// which works correctly

More information about the Digitalmars-d-learn mailing list