how to add a menu in win32 dialog box?
-
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
-
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
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.
-
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
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 -
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.
Thanks.