[ Home | Contents | Search | Next | Previous | Up ]
Date: 11/30/99
Time: 12:35:42 AM
Q. How to get rid of the button on the taskbar for my application?
A. Take a look at the two functions below one is the InitMainWindow
member
function for your TApplication Derived class this is where you DO NOT want
to set the Extended Window styles for your window. For Example
frame->Attr.ExStyle |= WS_EX_TOOLWINDOW; //Do not set that here.
Now Take a look at the over-ridden SetupWindow member function of your
TFrameWindow derived class ... which is the main window of your app. THIS
IS WHERE you want to set the extended styles for the main window. This is
accomplished by placing the line " ModifyExStyle(WS_EX_APPWINDOW,
WS_EX_TOOLWINDOW);" in this orver-ridden member function. Now what
WS_EX_TOOLWINDOW does is to tell the window to display on the desktop ...
BUT DO NOT display in the taskbar as a button ... neither does it appear in
the Alt+Tab list. Please note that the call to ModifyExStyle function must
come after you have called the SetupWindow member function of the class that
you have derived from ok? Take a look at the SetupWindow function below to
see.
//--------------------------------------------------------
// TMyApp
// ~~~~~
// Application intialization.
//
void TMyApp::InitMainWindow()
{
if (nCmdShow != SW_HIDE)
nCmdShow = (nCmdShow != SW_SHOWMINNOACTIVE) ? SW_SHOWNORMAL : nCmdShow;
TSDIDecFrame* frame = new TSDIDecFrame(0, GetName(), 0, true);
frame->SetFlag(wfShrinkToClient);
// Override the default window style for the main window.
//
frame->Attr.Style |= WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU
| WS_VISIBLE;
frame->Attr.Style &= ~(WS_CHILD | WS_CLIPCHILDREN | WS_MAXIMIZEBOX |
WS_THICKFRAME);
//frame->Attr.W = 430;
//frame->Attr.H = 100;
// Assign ICON w/ this application.
//
frame->SetIcon(this, IDI_SDIAPPLICATION);
frame->SetIconSm(this, IDI_SDIAPPLICATION);
status = new TMyMessageBar(GetMainWindow());
frame->Insert(*status, TDecoratedFrame::Bottom);
SetMainWindow(frame);
//SetMainWindow(frame);
}
---------------------------------------------------------------
void TSDIDecFrame::SetupWindow()
{
TDecoratedFrame::SetupWindow();
ModifyExStyle(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW);
TRect r;
GetWindowRect(r);
r.bottom += 30;
SetWindowPos(0, r, SWP_NOZORDER | SWP_NOMOVE);
// INSERT>> Your code here.
}
Das