Windows下设置钩子函数
当用户在window下操作时,钩子函数可以根据你的设置勾取window的操作消息
1.定义钩子函数
HWINEVENTHOOK hook = SetWinEventHook( _eventMin, _eventMax, NULL, WinEventProcSTATIC, 0, 0, WINEVENT_OUTOFCONTEXT);
2.撤销设置的钩子
UnhookWinEvent(hook);
3.钩子事件处理函数
void ProcessForgroundMonitor::winEventProc( HWINEVENTHOOK hWinEventHook, DWORD dwEvent, HWND hwnd, LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime)