Ooo, that's my favorite - create one menu and at least one submenu item:
EDIT: my appologiesVB Code:
Option Explicit Private Const MIM_BACKGROUND As Long = &H2 Private Const MIM_APPLYTOSUBMENUS As Long = &H80000000 Private Type MENUINFO cbSize As Long fMask As Long dwStyle As Long cyMax As Long hbrBack As Long dwContextHelpID As Long dwMenuData As Long End Type Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long Private Declare Function GetMenu Lib "user32" (ByVal hWnd As Long) As Long Private Declare Function SetMenuInfo Lib "user32" (ByVal hMenu As Long, mi As MENUINFO) As Long Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long Private Sub Command1_Click() Dim mi As MENUINFO With mi .cbSize = Len(mi) .fMask = MIM_BACKGROUND .hbrBack = CreateSolidBrush(vbYellow) SetMenuInfo GetMenu(Me.hWnd), mi 'main menu bar .fMask = MIM_BACKGROUND Or MIM_APPLYTOSUBMENUS .hbrBack = CreateSolidBrush(vbCyan) SetMenuInfo GetSubMenu(GetMenu(Me.hWnd), 0), mi 'this could a File menu perhaps End With DrawMenuBar Me.hWnd End Sub- I should've mentioned that this sample was inspired by Randy Birch's original article (link in my signature).




- I should've mentioned that this sample was inspired by Randy Birch's original article (link in my signature).
Reply With Quote