Click to See Complete Forum and Search --> : My ShellProc hook werks... but how do I use it?


cube01
August 24th, 1999, 08:54 PM
okay... here's my code:

HOOKPROC Shell;
Shell = ShellProc;
SetWindowsHookEx(WH_SHELL, *Shell, NULL, NULL);

That calls my ShellProc callback function...

it all compiles and runs fine. But how do I use it? I mean, how do I tell when an event happens?
I need to know if the callback thing receives a HSHELL_WINDOWCREATED hook code, so I used this code inside my ShellProc:

LRESULT CALLBACK ShellProc(int nCode, WPARAM wParam, LPARAM lParam)
{

if(nCode == HSHELL_WINDOWCREATED)
{
CSpyDlg dlg;
dlg.m_ctlProgs.AddString("A window was created"); ///This would add a string to a list box in my dlg app...
}
return 0;
}

But using that just causes an illegal operation on the window that was created...
What should I do differently?
Thanks alot for your time... Cube