winapi - Getting the menu handle -


i created menus , sub menus using resource editor in visual studio. want add items 1 of menus during run time. going use insertmenuitem function don't know how access hmenu variable.

loadmenu seems need. use load menu resource editor, this:

hmenu yourmenu = loadmenu( hinst,  // variable stored hinstance     makeintresource(idm_menu1) );  // replace idm_menu1 id of menu 

here lots of useful examples, may find useful. of them address issue, , might useful in future. study example of menu-item bitmaps section if you...

if need menu handle assigned window use getmenu member arx said. this:

hmenu yourmenu = getmenu(hwnd);  // hwnd hwnd of window owns menu 

do not forget destroy menu when no longer needed ( upon window destruction ) destroymenu.

this example might well. introductory tutorial win32, suggest read ( go home page , download both pdf , .zip file code examples ).

as have said before, question not entirely clear, if have further questions leave me comment.

hopefully answer solved problems. best regards.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -