Click to See Complete Forum and Search --> : How Do I Prevent My Application From Showing Up On the Screen's TASKBAR?


KEhlar
June 4th, 1999, 09:13 AM
Hi,

I've searched the forum on getting this accomplished and it seems that the solution is to set the extended style of the application's main CDialog object to WS_EX_TOOLWINDOW (or just check it in the resource manager). However it doesn't work for some reason. The application still shows up on the taskbar. I've included the relevant code, please let me know if you see something I'm doing incorrectly. FYI the size of the CDialog object is determined by the size of the monitor screen, thus the reason for calling SetWindowPos().

Here is the OnInitDialog() function where I set the style of the CTickerDlg object which inherits from CDialog:


BOOL CTickerDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog

SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

// Get the width and height of the monitor screen to determine the size and
// location of the ticker.

m_WinXSize = GetSystemMetrics (SM_CXSCREEN); // screen width.
m_WinYSize = GetSystemMetrics (SM_CYSCREEN); // screen height.
ModifyStyleEx(0, WS_EX_TOOLWINDOW);
SetWindowPos(NULL, 0, m_WinYSize-55, m_WinXSize, 30, SWP_NOZORDER | SWP_SHOWWINDOW);

return TRUE; // return TRUE unless you set the focus to a control
}

RajM
June 7th, 1999, 11:44 AM
Hi,
Its important that u remove the extended style WS_EX_APPWINDOW also.So change ModifyStyleEx to this
ModifyStyleEx(WS_EX_APPWINDOW,WS_EX_TOOLWINDOW).

KEhlar
June 7th, 1999, 12:37 PM
Thanks! It worked out beautifully.