
A way to remove a Dialog based app from the taskbar works, with a hitch
Thanks to S. Brent Faulkner for forwording fragment to me....
static const TCHAR szTrayClass[] = _T("Shell_TrayWnd");
static const TCHAR szTaskClass[] = _T("MSTaskSwWClass");
void CHiddenDialog::RemoveFromTaskbar()
{
ASSERT(::IsWindow(m_hWnd));
// Get the taskbar's window handle
HWND hwTray = ::FindWindowEx(NULL, NULL, szTrayClass, NULL);
HWND hwTask = ::FindWindowEx(hwTray, NULL, szTaskClass, NULL);
ASSERT( NULL != hwTask );
// Get id of the shell's hook message
UINT nMsg = ::RegisterWindowMessage( _T("SHELLHOOK") );
ASSERT( NULL != nMsg );
// Fake destruction of the window
::PostMessage(hwTask, nMsg, HSHELL_WINDOWDESTROYED, (LPARAM)m_hWnd);
Quote:
}
-----------------------------------
But, there is a hitch..... About half of the time, when the windows
screensaver starts the dialog box is not hidden. At this point I should
point out that this dialog box is a "always on top" window, which might
explain why it isn't being covered up, excpet that it was being covered up
before I inserted the above code into my app.
So, is there a way to tell that a screen saver has been activated, and
lower your window, or is there some other way to hide the app from the
taskbar?
Thanks for your help!