Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to add a menu in win32 dialog box?

how to add a menu in win32 dialog box?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionlearning
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mathivanaan
    wrote on last edited by
    #1

    Hi i am using insert--> resource use create the menus. Then how to add menus in Dialog box? pls give any url or steps? Regards, M.Mathivanan

    T A 2 Replies Last reply
    0
    • M mathivanaan

      Hi i am using insert--> resource use create the menus. Then how to add menus in Dialog box? pls give any url or steps? Regards, M.Mathivanan

      T Offline
      T Offline
      tagopi
      wrote on last edited by
      #2

      Hello, Create the Menu in Menu Resources. (for eg. IDR_MENUDLG) The dialog you want to add this menu (eg. IDD_DLGMNU) Now, in the dialog procedure of your dialog IDD_DLGMNU, in WM_INITDIALOG case, add like this. HMENU hmenu=LoadMenu(hInstance,MAKEINTRESOURCE(IDR_MENUDLG)); SetMenu(hwnd, hmenu); // --- hwnd is handle to window for your dialog IDD_DLGMNU. hope this will help. Thanks & Regards A. Gopinath.

      M 1 Reply Last reply
      0
      • M mathivanaan

        Hi i am using insert--> resource use create the menus. Then how to add menus in Dialog box? pls give any url or steps? Regards, M.Mathivanan

        A Offline
        A Offline
        Andrew Brock
        wrote on last edited by
        #3

        You can add it directly into the resource file unless you are using a dialog generated at runtime (which you arent) Just open the dialog in the resource editor in Visual Studio, select the dialog box, then down near the bottom of the properties window (View->Other Windows->Properties Window) there is an optiom there for Menu, just select your menu ID from the dropdown list. If you arent using the dialog editor, you can add it to the .rc file manually like this (the line in red):

        IDD_UNDELETE_DIALOG DIALOGEX 0, 0, 320, 200
        STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
        EXSTYLE WS_EX_APPWINDOW
        CAPTION "My Dialog"
        MENU IDR_MAINFRAME
        FONT 8, "MS Shell Dlg", 0, 0, 0x1
        BEGIN
        CONTROL "",IDC_FILES,"SysListView32",LVS_REPORT | LVS_AUTOARRANGE | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,98,0,222,200
        END

        1 Reply Last reply
        0
        • T tagopi

          Hello, Create the Menu in Menu Resources. (for eg. IDR_MENUDLG) The dialog you want to add this menu (eg. IDD_DLGMNU) Now, in the dialog procedure of your dialog IDD_DLGMNU, in WM_INITDIALOG case, add like this. HMENU hmenu=LoadMenu(hInstance,MAKEINTRESOURCE(IDR_MENUDLG)); SetMenu(hwnd, hmenu); // --- hwnd is handle to window for your dialog IDD_DLGMNU. hope this will help. Thanks & Regards A. Gopinath.

          M Offline
          M Offline
          mathivanaan
          wrote on last edited by
          #4

          Thanks.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups