kipnis@janus.Berkeley.EDU (Gary Kipnis) (02/02/90)
Hi, I am trying to change one of the menu items in the main menu bar. SDK documentation says that only popup menu items can be changed using ChangeMenuItem(), so I tried using SetClassLong() and then DrawMenuBar() but that locked the computer up. I also tried just loading the second version of the menu, but I didn't know what to do with the menu handle. Does anyone have any suggestions? Thank you, gary
paul@cscnj.csc.COM (Paul Moody) (02/03/90)
In article <34071@ucbvax.BERKELEY.EDU>, kipnis@janus.Berkeley.EDU (Gary Kipnis) writes: > > Hi, I am trying to change one of the menu items in the main menu bar. > SDK documentation says that only popup menu items can be changed using > ChangeMenuItem(), so I tried using SetClassLong() and then DrawMenuBar() > but that locked the computer up. > I also tried just loading the second version of the menu, but I didn't know > what to do with the menu handle. > > Does anyone have any suggestions? > You can change a main menu item, but it must be done MF_BYPOSITION. Position includes all main menu items preceeding what you want to change. It may be easier to create a completly new menu on the fly and copy the old to the new. Replace what you want as you go. Once complete, just swap menus. It is MUCH easier to swap menus. Just call SetMenu(hWnd, hMenu); hMenu MUST have been returned from CreateMenu, LoadMenu or LoadMenuIndirect. If you only have two menus, load both and switch between them. -- Paul Moody UUCP: rutgers!cscnj!paul Computer Sciences Corporation # the opinions expressed are entirely imaginary #
bturner@hpcvlx.cv.hp.com (Bill Turner) (02/06/90)
> It is MUCH easier to swap menus. Just call SetMenu(hWnd, hMenu); > hMenu MUST have been returned from CreateMenu, LoadMenu or > LoadMenuIndirect. WARNING -- if you do this, when the window is destroyed the current menu is also destroyed. I.e, if you have called CreateMenu for three different menus, and set one of them as the main menu, that one will be automagically destroyed but the other two will continue to take up memory. Also remember that if you register a menu with the window, it will be automatically created, but if you set a different menu it will not be automatically destroyed. --Bill Turner (bturner@hp-pcd.hp.com) HP Interface Technology Operation