Re: no-TitleBar Dialog in VS 7.1 ?
I am using Windows 2000 Pro. And with the code I posted, the taskbar has
"move" and "Close", and nothing else.
And for the properties, "Border" is set to none. Caption is blank(empty).
The "Style" is overlapped. "System Menu" is false. Also, there is no
caption, however, I have found a way to get text on the taskbar button. The
SetWindowText member has no effect though.
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:e9afa3hklmug0kjieh6jj1aiuflfg1o3nf@4ax.com...
It would probably help if you told us what the differences are that you
see, and what
version of the OS you are using.
joe
On Wed, 25 Jul 2007 17:27:53 GMT, "cdg" <anyone@anywhere.com> wrote:
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);
}
}
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm