Right-Justifed Menu Bar
17-Oct-91 01:11:29
Sb: #3501-Right-Justifed Menu Bar
Fm: Ted M. Young 76703,4343
To: Chris Calkins 76236,1520
Chris,
Interesting…in fact, you don't even need to go through the trouble of
using a hex sector editor, you can use the Windows menu API calls to
accomplish the same thing:
DefInt A-Z <– put in the Declarations section
'– get the menu handle for the form
hMenu = GetMenu(Form1.hWnd)
'– get the handle to the submenu: nPos is the item number starting at 0
' e.g., if &Help is the 3rd main menu item, nPos = 2
hSubMenu = GetSubMenu(hMenu, nPos)
'– create the menu string (you can use GetMenuString if you don't
' want to create the menu string from scratch, but merely change
' what was previously there — see the Win Ref manual)
Menu$ = Chr$(8) + "&Help"
'– nPos is the same as above in hSubMenu
' MF_BYPOSITION = &H400
nResult = ModifyMenu(hMenu, nPos, MF_BYPOSITION, hSubMenu, Menu$)
'– redraw the menu bar
DrawMenuBar Form1.hWnd
Don't forget to put in the declarations for GetMenu, GetSubMenu,
ModifyMenu, and DrawMenuBar in your global declarations module.
– Ted