Bug in ShowWindow in Windows 7
-
Hello everybody. For *two weeks*, each day since I installed Windows 7, I have been struggling to get something to work. Something which worked perfectly ok in XP. It's driving me mad, poisoning my life, ruining my days. Why such a simple task works SO CHAOTICALLY!? I think I discovered a bug in Windows 7, specifically in the way the ShowWindow function works in the standard theme (Aero). To demonstrate this, I uploaded 2 C# WinForms applications and their source code. http://www.axonnsd.org/W/P007/BugsDemo.rar HideableApplication represents an application which you can hide in the SysTray when you close it. Double clicking the SysTray icon reveals it and right clicking will reveal the "Exit" option. HideableApplicationRevealer attempts to show HideableApplication's window. The reason I need to accomplish this task is because I minimize my Total Commander and FireFox to the Tray and I want to bring them back via a HotKey. Total Commander offers such a functionality but it is broken. On Windows XP I managed to accomplish both these tasks without any problems, using the code I attached. On Windows 7, the behavior is erratic at best, and non-functional at worst. When HideableApplication runs inside Visual Studio everything works: - Trying to reveal it via HideableApplicationRevealer from Visual Studio => SUCCESS - Trying to reveal it via manual execution of HidebleApplicationRevealer.exe from Debug folder => SUCCESS - Trying to reveal it via running HideableApplicationRevealer.exe via keyboard shortcut => SUCCESS - Trying to reveal it via running HIdeableApplicationRevealer.exe via a Scheduled Task with Admin Rights => SUCCESS. When HideableApplication was executed manually (via .exe from Debug folder) AND Visual Studio IS STARTED, it works if I use admin rights or run it manually: - Trying to reveal it via HideableApplicationRevealer from Visual Studio => FAIL - Trying to reveal it via manual execution of HidebleApplicationRevealer.exe from Debug folder => SUCCESS - Trying to reveal it via running HideableApplicationRevealer.exe via keyboard shortcut => FAIL - Trying to reveal it via running HIdeableApplicationRevealer.exe via a Scheduled Task with Admin Rights => SUCCESS. - Trying to reveal it via running HideableApplicationRevealer.exe via keyboard shortcut (start menu) which has been given ADMIN RIGHTS => SUCCESS. When HideableApplication was executed manually (via .exe from Debug folder) AND Visual Studio HAS BEEN SHUT DOWN: it only works if I run it manually (double clic