// JP opened flex table

Click to See Complete Forum and Search --> : Detecting Start Menu


h34
January 13th, 2008, 11:14 AM
I have written a short program that removes "ghost icons" from the system tray (the icons that stick around after a program terminates unexpectedly).. I wanted to add functionality so that it also sets the system tray icons' tooltip z-order to "always on top" (see http://support.microsoft.com/kb/912650) however I have run into a small problem trying to do this.

HWND hShell_TrayWnd = ::FindWindow( _T("Shell_TrayWnd"), NULL );

the statement
::SetWindowPos( hShell_TrayWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE );
does not seem to do the trick, rather I have to use two calls,
::SetWindowPos( hShell_TrayWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE );
::SetWindowPos( hShell_TrayWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE );
and this has an unintended side effect. If a submenu of the start menu (programs, for example) happens to be open when these commands run, the submenu is moved "behind" the main portion of the start menu.

Any ideas how I can get around this?

p.s., this application is intended to run as an idle process, looping every few seconds. this is why its unacceptable to have the start menu flicker when it "does its thing"...

golanshahar
January 13th, 2008, 02:43 PM
This post (http://www.codeguru.com/forum/showthread.php?t=150081&p=1225432) should help you.

Cheers

h34
January 13th, 2008, 10:21 PM
Thanks for the response but I think you misunderstood my post.

The functionality to clear ghost icons is already built in my application (furthermore, it does not depend on simulating mouse movements or any such thing as the method in that post does)...

after that functionality was built and working, i decided to add functionality to fix the windows bug documented in http://support.microsoft.com/kb/912650, in addition to closing ghost icons..THIS is where I am running into trouble. My code works, but if I allow the fix to run with the programs main loop, and the start menu happens to be open when it runs, i get the undesired consequence i mentioned earlier.

//JP added flex table