Quote:
>How do I add a menu bar to my dialog-based app??
You can use the resource editor to attach a menu to a dialog, or you can do
so in code with something like:
// In OnInitDialog
CMenu menu;
if (menu.LoadMenu(IDR_MENU))
{
CRect rcPre;
GetClientRect(rcPre);
if (SetMenu(&menu))
{
// Window assumes ownership of HMENU object, so release it.
menu.Detach();
// Resize the dialog window. The client area has shrunk
// to accommodate the menu bar.
CRect rcPost;
GetClientRect(rcPost);
CRect rcWnd;
GetWindowRect(rcWnd);
rcWnd.bottom += rcPre.Height()-rcPost.Height();
MoveWindow(rcWnd);
CenterWindow();
}
}
--
Doug Harrison
Microsoft MVP - Visual C++