Win32 function vs delegate issues with api
Prudence via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Sep 8 17:18:54 PDT 2015
I have
hook = SetWindowsHookEx(WH_MOUSE, &Proc, NULL, ThreadID);
Proc is the standard hook proc:
public extern (Windows) LRESULT Proc(int code, WPARAM wParam,
LPARAM lParam)
I get a type mismatch because Proc is a delegate and
SetWindowsHookEx expects a function. Making proc static works but
not the behavior I want since all this stuff is wrapped in a
class.
Is there any way to pass Proc to SetWindowsHookEx without issues
of GB and such?
Error: function windows.winuser.SetWindowsHookExA (int, extern
(Windows) int function(int, uint, int), void*, uint) is not
callable using argument types (const(int), extern (Windows) int
delegate(int code, uint wParam, int lParam), void*, uint)
I could cast Proc to a function, obviously, but I'll loose the
delegate behavior and create problems when I try to use this
inside Proc?
More information about the Digitalmars-d-learn
mailing list