From: ChalkTrauma on
I know I must be missing something, because I can't find any
information about this problem.

What I'm trying to do is monitor when top-level windows are minimized
and maximized.

The SH_SHELL hook seemed to be the perfect solution, but I can't seem
to trap the HSHELL_GETMINRECT action in my hooking code.

I have my hooking code in a DLL and I install the hook with the
following code:

HHOOK DLLEXPORT InstallMsgHook( void )
{

_hMyMsgHook = SetWindowsHookEx(WH_SHELL,(HOOKPROC)MsgHook,
_hInstance, 0);

return _hMyMsgHook;

}

with _hMyMsgHook being a HHOOK handle that I have delcared in my shared
data segment.

Then I report the messages in the DLL with the following code:

LRESULT DLLEXPORT CALLBACK MsgHook(int nCode, WPARAM wParam, LPARAM
lParam)
{
if(nCode < 0)
{
return CallNextHookEx(_hMyMsgHook, nCode,wParam, lParam);
}

switch(nCode)
{
case HSHELL_WINDOWCREATED:
OutputDebugString("created");
break;
case HSHELL_GETMINRECT:
OutputDebugString("min/max");
break;
case HSHELL_WINDOWDESTROYED:
OutputDebugString("destroyed");
break;
case HSHELL_WINDOWACTIVATED:
OutputDebugString("activated");
break;

}

if (_hMyMsgHook)
return CallNextHookEx(_hMyMsgHook, nCode, wParam, lParam);
else return 0;
}

I'm using DebugView to watch the messages, and I see the
created,destroyed, and activated messages at the times I should, but I
NEVER see a 'min/max' string. Is there something I am not doing?

I am running on WindowsXP Pro SP2 and I am using VC8 Standard to build
the DLL and the host EXE that installs the hook.

From: ChalkTrauma on
This code ended up being correct..

After testing this on 3 different machines with 2 different operating
systems I found that on 2 machines it failed, and on 1 it worked.

The only thing on the two failing machines that was the same was an
install of NAV 9.0.5.100.

After uninstalling Norton Antivirus, the code worked perfectly. On
reinstalling NAV, the problem returned.

So it looks like NAV is catching HSHELL_GETMINRECT and not forwarding
the info to the rest of the hook chain. ugh... who do I write to.