Re: no-TitleBar Dialog in VS 7.1 ?
Could anyone help me with the correct procedures for creating a
dialog-based program that would have no titlebar in Visual C++ with VS2003.
And this dialog would be used with a bitmap background skin. But it would
need a taskbar menu for Restore, Minimize, Close and an About Box.
I have done this in Visual C++ 6, but in VS7.1 I have no idea of how to
do this.
I don't need any information about processing the bitmap. The only
problem I am having is how to setup the menu for the taskbar button and no
titlebar.
"cdg" <anyone@anywhere.com> wrote in message
news:tKLpi.2924$ax1.221@bgtnsc05-news.ops.worldnet.att.net...
I have been using the code below with Visual C++ 6 for creating a
bitmap
background, no-TitleBar Dialog program. But I have recently started using
Visual Studio 2003, and this code no longer creates the same right-click
menu on the taskbar button.
I needed to have a Restore, Minimize, Move(required for dragging), Close
and an About Box. Could anyone explain how the code and properties should
be
changed to create this menu.
Here is the code:
BOOL CBmpBkgdBmpButtonDlg::OnInitDialog()
{
CDialog::OnInitDialog():
ModifyStyle(0,WS_SYSMENU); //**activates system menu**
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
pSysMenu->RemoveMenu(SC_MAXIMIZE, MF_BYCOMMAND); //**removes max**
pSysMenu->RemoveMenu(SC_SIZE, MF_BYCOMMAND); //**removes size**
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX,
strAboutMenu);
}
}
// 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
// TODO: Add extra initialization here
ModifyStyle(WS_CAPTION,0,SWP_DRAWFRAME); //**removes caption bar**
SetWindowText("Any Text Here"); //**sets taskbar button text**
return TRUE; // return TRUE unless you set the focus to a control
}
void CBmpBkgdBmpButtonDlg::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex,
BOOL bSysMenu)
{
CDialog::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
// TODO: Add your message handler code here
if(pPopupMenu && bSysMenu)
{
pPopupMenu->EnableMenuItem(SC_RESTORE, IsIconic() ? MF_ENABLED
:
MF_GRAYED);
pPopupMenu->EnableMenuItem(SC_MOVE, IsIconic() ? MF_DISABLED :
MF_GRAYED);
pPopupMenu->EnableMenuItem(SC_MINIMIZE, IsIconic() ? MF_GRAYED
:
MF_ENABLED);
}
}