|
|
Title | Align a form's Help menu on the right side of the menu bar |
Description | This example shows how to align a form's Help menu on the right side of the menu bar in Visual Basic 6. |
Keywords | align help menu, justify help menu, help menu |
Categories | Controls, Software Engineering |
|
|
Use the GetMenu function to get the main menu's handle. Use GetMenuItemInfo to get information about the Help menu. This code specifies the menu by its index, numbered from 0.
The program combines the menu item's fType value with MFT_RIGHTJUSTIFY to make the menu right justified and then calls SetMenuItemInfo to update the item.
|
|
Private Sub Form_Load()
' Index of Help menu in main menu (counting from 0).
Const help_menu_index = 1
Dim menu_handle As Long
Dim i As Integer
Dim menu_info As MENUITEMINFO
' Get the main menu handle.
menu_handle = GetMenu(Me.hwnd)
' Initialize the menu information.
With menu_info
.cbSize = Len(menu_info)
.fMask = MIIM_FTYPE
End With
' Get the menu item's information.
GetMenuItemInfo menu_handle, help_menu_index, _
True, menu_info
' Indicate that we will set fType.
With menu_info
.fMask = MIIM_FTYPE
.fType = .fType Or MFT_RIGHTJUSTIFY
End With
' Set the MFT_RIGHTJUSTIFY flag.
SetMenuItemInfo menu_handle, help_menu_index, _
True, menu_info
End Sub
|
|
|
|
|
|