
Prevent taskbar entry for dialog-based app?
Quote:
>Here is my PreCreateWindow(...) function which does what you are looking
>for, note the line:
>cs.dwExStyle |= WS_EX_TOOLWINDOW;
>that is the line that sets the window style to not show up in the task bar.
>BOOL CCommandWindow::PreCreateWindow(CREATESTRUCT& cs) {
> if(!CFrameWnd::PreCreateWindow(cs)) return FALSE;
> cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
> cs.dwExStyle |= WS_EX_ACCEPTFILES;
> cs.dwExStyle |= WS_EX_TOOLWINDOW;
> return TRUE;
>}
>tim
Are you trying to have no taskbar entry ever, or no taskbar entry when the
dialog isn't visible (when it's only in the system tray)? If you are looking
for the latter, here's the method I found for doing it.
Add a member to the dialog for whether the dialog is visible or not. I
initialize mine to start out hidden.
BOOL m_bVisible;
Add a handler to the dialog for OnWindowPosChanging with the following code:
void CTestsrvrDlg::OnWindowPosChanging( WINDOWPOS* lpwndpos )
{
if ( !m_bVisible )
lpwndpos->flags &= ~SWP_SHOWWINDOW ;
CDialog::OnWindowPosChanging(lpwndpos);
}
When the user wants to display the dialog:
m_bVisible = TRUE;
ShowWindow( SW_SHOWNORMAL );
When the user closes the dialog:
m_bVisible = FALSE;
ShowWindow( SW_HIDDEN );
Eliot Rogers
EF Systems