fork download
  1. HHOOK g_hMouse;
  2.  
  3. int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  4. {
  5. ...
  6.  
  7. g_hMouse = SetWindowsHookEx(WH_MOUSE_LL, LowLevelMouseProc, GetModuleHandle(NULL), 0);
  8.  
  9. f (!g_hMouse)
  10. {
  11. return 0;
  12. }
  13.  
  14. while ( GetMessage(&msg, NULL, 0, 0) )
  15. {
  16. TranslateMessage(&msg);
  17. DispatchMessage(&msg);
  18. }
  19.  
  20. UnhookWindowsHookEx(g_hMouse);
  21.  
  22. return (int) msg.wParam;
  23. }
  24.  
  25. LRESULT CALLBACK LowLevelMouseProc(int nCode, WPARAM wParam, LPARAM lParam)
  26. {
  27. char szBuf[128];
  28. int errcode = 0;
  29.  
  30. LPMSLLHOOKSTRUCT lhook = (LPMSLLHOOKSTRUCT)lParam;
  31.  
  32. switch (LOWORD(wParam))
  33. {
  34. case WM_LBUTTONDOWN:
  35. ...
  36. break;
  37. }
  38.  
  39. return CallNextHookEx(g_hMouse,nCode,wParam,lParam);
  40. }
  41.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1:1: error: unknown type name 'HHOOK'
 HHOOK g_hMouse;
 ^
prog.c:3:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'WinMain'
 int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
              ^
prog.c:25:1: error: unknown type name 'LRESULT'
 LRESULT CALLBACK LowLevelMouseProc(int nCode, WPARAM wParam, LPARAM lParam)
 ^
prog.c:25:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'LowLevelMouseProc'
 LRESULT CALLBACK LowLevelMouseProc(int nCode, WPARAM wParam, LPARAM lParam)
                  ^
stdout
Standard output is empty