Hi, I have set up a hook to moniter which window is activated and then display the title of the window in a message box, but it only displays the title of the window when you activate command boxes, and only displays messageboxes for the first cmd to be activated and ignores the rest. this probally doesn't make since, but can anyone look over my code to see what is going wrong?
variable declaration and setting up the hook...
Code:HHOOK hWindowHook; hWindowHook = SetWindowsHookEx (WH_SHELL, (HOOKPROC)WindowEvent, hExe, 0);
the function that is only called once each time the program is opened, and stops notifications after...
anyways if you can't find what is causing it to act this way, thanks for reading my post anyways!Code:__declspec(dllexport) LRESULT CALLBACK WindowEvent (int nCode, HWND wParam, LPARAM lParam, WPARAM wParam2){ if(nCode < 0) return CallNextHookEx(NULL, nCode, wParam2, lParam); if(nCode == HSHELL_WINDOWACTIVATED){ char buf[100]; GetWindowText(wParam, buf, 100); MessageBox(NULL, buf,buf, 0); }




Reply With Quote