I am trying to use a global shell hook to listen for windows created and destroyed events, but it seems as though my program is only registering the destroyed event for the local thread. No creation events at all, and definitely not the global events that I think they should be.
I have spent the last day scouring the googles as well as codeguru, codeproject, and msdn, but it looks to me like I m doing it right, although I am clearly not. Can anybody help point me in the right direction?
#pragma data_seg(".SHARE")
HWND hWndServer = NULL;
HHOOK g_shell_hook = NULL;
#pragma data_seg()
#pragma comment(linker, "/section:.SHARE,RWS")
TASKBAR_API int StartShellHook(HWND hWnd)
{
g_shell_hook = SetWindowsHookEx(WH_SHELL, ShellProc, g_dll_module_handle, 0);
if(g_shell_hook)
hWndServer = hWnd;
return (g_shell_hook != NULL);
}
Here is my code for hooking into the shell, which all seems to be correct to me, but again, its not giving the proper output. Right now the ShellProc function is just set up to do trivial variable incrementation on windows create and destroy messages, just for a line to put a break point on, but the program only hits the breaks for the destroy message of the local window. again, any help would be fantastic, thank you very much in advance.