我改成拉 LRESULT CALLBACK KeyProc(int nCode, WPARAM wParam, LPARAM lParam) glhHook=SetWindowsHookEx(WH_KEYBOARD,KeyProc,glhInstance,0); 还是出现error C2664: 'SetWindowsHookExA' : cannot convert parameter 2 from 'long (int,unsigned int,long)' to 'long (__stdcall *)(int,unsigned int,long)' None of the functions with this name in scope match the target type
我改成 glhHook=SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyProc,glhInstance,0); 可还是 error C2440: 'type cast' : cannot convert from '' to 'long (__stdcall *)(int,unsigned int,long)' None of the functions with this name in scope match the target type
你的函数原型错误应该向上面那样
glhHook=SetWindowsHookEx(WH_KEYBOARD,(LPTHREAD_ROUTLINE)KeyProc,glhInstance,0);
LRESULT WINAPI KeyProc(int nCode, WPARAM wParam, LPARAM lParam)
glhHook=SetWindowsHookEx(WH_KEYBOARD,KeyProc,glhInstance,0);
是怎么不行啊!!
试试看
我的函数原型是这样
LRESULT WINAPI KeyProc(int nCode, WPARAM wParam, LPARAM lParam)
glhHook=SetWindowsHookEx(WH_KEYBOARD,KeyProc,glhInstance,0);
改成
LRESULT CALLBACK KeyProc(int nCode, WPARAM wParam, LPARAM lParam)
glhHook=SetWindowsHookEx(WH_KEYBOARD,KeyProc,glhInstance,0);
LRESULT CALLBACK KeyProc(int nCode, WPARAM wParam, LPARAM lParam)
glhHook=SetWindowsHookEx(WH_KEYBOARD,KeyProc,glhInstance,0);
还是出现error C2664: 'SetWindowsHookExA' : cannot convert parameter 2 from 'long (int,unsigned int,long)' to 'long (__stdcall *)(int,unsigned int,long)'
None of the functions with this name in scope match the target type
试试看?
可还是
error C2440: 'type cast' : cannot convert from '' to 'long (__stdcall *)(int,unsigned int,long)'
None of the functions with this name in scope match the target type