Wednesday, February 25, 2009

[VC++] Hiding application button from Taskbar

If you do not want to show your application on Windows Taskbar while it is running, modify the CMainFrame::PreCreateWindow() by adding WS_EX_TOOLWINDOW style and removing WS_EX_APPWINDOW style to Create Structure. See the below code which will do the same.
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// Adding Tool window style
cs.dwExStyle = WS_EX_TOOLWINDOW ;
// Removing App window style
cs.dwExStyle &= ~WS_EX_APPWINDOW ;
return TRUE;
}

No comments: