How to add event hook for mouse operations in c++ win32?

321 Views Asked by At

I wanted to add a system foreground event hook to track the active window and track mouse clicks(right-click) within the active window. I add eventHook for EVENT_SYSTEM_FOREGROUND, which is working as expected, my hook:

HWINEVENTHOOK hHook = SetWinEventHook (EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND,
    NULL, MyEventHandler, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);

where MyEventHandler is

void CALLBACK MyEventHandler (
  HWINEVENTHOOK hWinEventHook,
  DWORD event,
  HWND hwnd,
  LONG idObject,
  LONG idChild,
  DWORD idEventThread,
  DWORD dwmsEventTime
)
{ ... }

How to add a mouse event handler to track mouse operations like right click?

0

There are 0 best solutions below