Prevent taskbar entry for dialog-based app? 
Author Message
 Prevent taskbar entry for dialog-based app?

I have an MFC dialog-based application which places an entry for my program
in the system taskbar.  How can I prevent this?

Thanks,

Don Metzler
Barefoot Productions Software Development



Fri, 12 May 2000 03:00:00 GMT  
 Prevent taskbar entry for dialog-based app?

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;

Quote:
}

tim
Quote:

>I have an MFC dialog-based application which places an entry for my program
>in the system taskbar.  How can I prevent this?

>Thanks,

>Don Metzler
>Barefoot Productions Software Development



Fri, 12 May 2000 03:00:00 GMT  
 Prevent taskbar entry for dialog-based app?

You can't tell the taskbar to 'not show' a particular application...

The taskbar won't show entries for any window that has the window
style 'WS_TOOLWINDOW'.. Also, it won't show an entry if the window is
hidden.

// CHRIS



Quote:
>I have an MFC dialog-based application which places an entry for my program
>in the system taskbar.  How can I prevent this?

>Thanks,

>Don Metzler
>Barefoot Productions Software Development



Fri, 12 May 2000 03:00:00 GMT  
 Prevent taskbar entry for dialog-based app?

Two methods:

1) create a window which is hidden and make that the parent of your main
dialog.

2) create the window with the extended window style WS_EX_TOOLWINDOW
(i.e. override PreCreateWindow, set the style bit in dwExStyle of
CREATESTRUCT)
You may also need to override Create to call CreateWindowEx if it is not
already doing so.
Look at the MFC source for the class you're using.

-Andy



Fri, 12 May 2000 03:00:00 GMT  
 Prevent taskbar entry for dialog-based app?

All U have to do ist to remove this line from your *.rc-File:
EXSTYLE WS_EX_APPWINDOW
U do not have to use the WS_EX_TOOLWINDOW style.
_______________________________________________

Daffy
Greedings from Erlangen, Germany
_______________________________________________


Quote:
>I have an MFC dialog-based application which places an entry for my program
>in the system taskbar.  How can I prevent this?

>Thanks,

>Don Metzler
>Barefoot Productions Software Development



Sat, 13 May 2000 03:00:00 GMT  
 Prevent taskbar entry for dialog-based app?

Andy,

Quote:
> 1) create a window which is hidden and make that the parent of your main
> dialog.

Regarding the above method - can I swap the state of this?  There are times
I want the program's dialog to show in the task bar (when it has a caption
and minimize box) and other times when I don't want it to show (no caption
and no ability to minimize).  Would this involve swapping the handle of the
main window in the CWinApp class?

Thanks,

Don



Sat, 13 May 2000 03:00:00 GMT  
 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



Sat, 13 May 2000 03:00:00 GMT  
 Prevent taskbar entry for dialog-based app?

Quote:

>Andy,

>> 1) create a window which is hidden and make that the parent of your main
>> dialog.

>Regarding the above method - can I swap the state of this?  There are times

Hmmm, I don't know - I haven't tried this.  You could try SetParent().

-Andy



Sat, 13 May 2000 03:00:00 GMT  
 Prevent taskbar entry for dialog-based app?

Eliot,

I want my dialog app to appear in the taskbar when it has a caption and can
be moved.  I do not want it to appear when it is without a caption (ie
docked to an edge of the desktop).

I guess it is a matter of toggling the WS_EX_TOOLWINDOW bit, but I'd also
like to have the ability to have a caption and tool window which would show
up in the taskbar.

Thanks,

Don



Mon, 15 May 2000 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Showing taskbar visible dialog from dialog based app

2. Updating the Taskbar from a dialog based app

3. dialog based app in taskbar

4. A way to remove a Dialog based app from the taskbar works, with a hitch

5. Preventing ESC from calling OnCANCEL() (Dialog-based app)?

6. How to prevent app from showing in taskbar

7. Preventing New Windows From CHtmlView Based App

8. Resizing a dialog based app based on its view's size

9. How to hide dialog based applinction on taskbar

10. Modeless dialog in a dialog-based app

11. dialog within dialog based apps

12. 2nd Dialog never appears in Dialog based app

 

 
Powered by phpBB® Forum Software