我正试图像这样挂钩鼠标:
#include <windows.h>
#include <stdio.h>
HHOOK mouseHook;
LRESULT WINAPI MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
MessageBox(0, "Not Called :-(", "M", 0);
return CallNextHookEx(mouseHook, nCode, wParam, lParam);
}
int main()
{
mouseHook = SetWindowsHookEx(WH_MOUSE,
(HOOKPROC)MouseHookProc,
GetModuleHandle(NULL),
0);
printf("Press enter to exit.\n");
getchar();
return 0;
}
但消息框永远不会出现。我认为一切都很好,但似乎有些不对劲。
提前致谢。