Dialog based app menu 
Author Message
 Dialog based app menu

How do I add a menu bar to my dialog-based app??


Sat, 06 Aug 2005 21:16:33 GMT  
 Dialog based app menu

Quote:
> How do I add a menu bar to my dialog-based app??

Open its properties in the dialog editor, select the ID for the MENU
resource in the box that is labeled something like "Menu:".
--
Jeff Partch [VC++ MVP]


Sat, 06 Aug 2005 21:35:55 GMT  
 Dialog based app menu

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++



Sat, 06 Aug 2005 21:36:49 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Dialog Based Apps - Menu & Windows :: MFC

2. Pop up menu in Dialog based App

3. trying to add menu to dialog based app

4. Newbie : Adding Menu Bar and Tool Bar to Dialog Based App

5. creating pop-up menus with dialog based apps gets assert error

6. Menu enabling in Dialog-based app

7. Using a Menu in a Dialog-based app

8. menu in Dialog based app

9. Checking menu items in dialog based app.

10. Menus and dialog-based apps (again)

11. Updating menu items in dialog-based apps: Solution

12. Menus and dialog-based apps

 

 
Powered by phpBB® Forum Software