how to call a menu by clicking a button from a dialog?
-
hello, i'm doing a project using mfc, vc++... i'd created a dialog as my first window, i decided to create a menu as my second window, however, to link the menu to the dialog is not as easy as what i think... if i wanna call a second dialog using the first dialong, i may use the .domodal to call it... but if i wanna call a menu, what should i do with it??? help!!!
-
hello, i'm doing a project using mfc, vc++... i'd created a dialog as my first window, i decided to create a menu as my second window, however, to link the menu to the dialog is not as easy as what i think... if i wanna call a second dialog using the first dialong, i may use the .domodal to call it... but if i wanna call a menu, what should i do with it??? help!!!
I guess it's CMenu::TrackPopupMenu you're looking for, probably with TPM_RETURNCMD flag. Tomasz Sowinski -- http://www.shooltz.com
no animal was harmed more than once during creation of this post
-
hello, i'm doing a project using mfc, vc++... i'd created a dialog as my first window, i decided to create a menu as my second window, however, to link the menu to the dialog is not as easy as what i think... if i wanna call a second dialog using the first dialong, i may use the .domodal to call it... but if i wanna call a menu, what should i do with it??? help!!!
If you want the menu options to always be available. Do something like this in your OnInitDialog() CMenu menu; menu.LoadMenu(ID_OF_MENU); SetMenu(menu.m_hMenu); menu.Detach();// now owned by dialog DrawMenuBar(); The dialog will destroy the menu automatically when itselef is destroyed You then just need to write ON_COMMAND() handlers for each item. If you need to enable/disable items, handle the WM_INITMENUPOPUP message and process the individual items there. Roger Allen - Sonork 100.10016 Roger Wright: Remember to buckle up, please, and encourage your friends to do the same. It's not just about saving your life, but saving the quality of life for those you may leave behind...