Original Post
Hi, I try to pass a member-function of a C++ class to a Win32-API function. in the last line this compiler error occurres: error C2664: 'SetWindowsHookExA' : cannot convert parameter 2 from 'LRESULT (int,WPARAM,LPARAM)' to 'HOOKPROC' now HOOKPROC is defined as:
struct HookData {
...
LRESULT HookCallback(int code, WPARAM wparam, LPARAM lparam);
};
LRESULT HookData::HookCallback(int code, WPARAM wparam, LPARAM lparam)
{ ... }
// later in the source:
HookData *pHook = new HookData();
SetWindowsHookEx(hookID, pHook->HookCallback, g_AppInstance, threadID);
typedef LRESULT(*HOOKPROC)(int, WPARAM, LPARAM);
So I am not sure what happend: Is it maybe a problem to provide a member-function to that API-function? Or do I need a prefix like CALLBACK/__stdcall or something like that? thanks, Constantin