Page 1 of 1

Task bar hook

PostPosted: Sep 22, 2007 @ 3:19am
by j.edwards
I've been making a task bar hook and so far everything has been quite straight forward. However, I'm stuck with how to identify the current window to send it either a WM_CLOSE or minimize it based on whether it has an "OK" or "smart minimize". I don't want to call the default wndproc for the mousedown/up messages because it causes it to redraw and I'm drawing it myself.

Minimize is working ok - haven't had a case where it doesn't work properly yet.

Close works for some windows but not others.

Originally I thought it was just a matter of GetForegroundWindow() to get the current window and send it a WM_CLOSE. However, if I have my task bar hook running and go to calendar and "Menu -> New Appointment" it displays a window that has an "OK" so should respond to a WM_CLOSE as expected, but it just does nothing. I don't know if the problem is GetForegroundWindow() is not returning the correct window - i.e. maybe it's returning the main window not that specific dialog? or maybe it's the window doesn't respond to a normal WM_CLOSE and needs something else as well?

PostPosted: Sep 22, 2007 @ 3:44pm
by Dan East
Have you tried using Remote Spy to get the window handle of the Appointment window? You can then see if GetForegroundWindow is returning the proper value.

Dan East

PostPosted: Sep 22, 2007 @ 4:00pm
by j.edwards
I've tried, but it's been a bit problematic - it only lets me select a 2003 device and I'm working on a 2005 device so that may be why. It only logs the first about 0.5sec of messages and then stops and I have to restart it to get any more messages.

Have MS released updates to remote spy?

Having a look at the window list there are a few calendar windows, and they don't seem to change count (or their children) when I open the appointment window. I wonder if it's a separate dialog that may not be a child of any window titled "Calendar".