I am monitoring process activity on a windows machine. I got one useful link from MSDN saying important Events to Monitor with this information I started building a small piece of code using WINAPI call - SetWinEventHook The code is below
But using this I am unable to get control when those event encountered which is listed on that link Events to Monitor
Can anyone please suggest, why I am not able to receive these mentioned events
LRESULT CALLBACK WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
switch (iMsg)
{
case WM_CREATE:
{
HWINEVENTHOOK st;
// EVENT_SYSTEM_MENUSTART
st = SetWinEventHook(0x44E, 0x44E, NULL, WinEventProc, 0, 0, WINEVENT_SKIPOWNPROCESS);
break;
}
case WM_SHOWWINDOW:
{
//MessageBox(hwnd, L"WM_SHOWWINDOW", L"Message", MB_OK);
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
ExitProcess(0);
break;
}
}
return DefWindowProc(hwnd, iMsg, wParam, lParam);
}
void CALLBACK WinEventProc(HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd, LONG idObject, LONG idChild, DWORD idEventThread, DWORD dwmsEventTime)
{
char buffer[100] = {"\0"};
sprintf_s(buffer, "Event [%d]\n Handle [%p]\n idEventThread [%d]\n EventTime [%d]", event, hwnd, idEventThread, dwmsEventTime);
MessageBoxA(hwnd, buffer, "Message", MB_OK);
}