'Este proyecto necesita un form con un menu y al menos un sub-menu
'tambien necesita un picturebox (Picture1) con un pequeño bitmap blanco y negro de aprox. 8x8 pixeles.
Const MF_BYPOSITION = &H400&
Private Declare Function GetMenu 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 SetMenuItemBitmaps Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal hBitmapUnchecked As Long, ByVal hBitmapChecked As Long) As Long
Private Sub Form_Load()
Dim hMenu As Long, hSubMenu As Long
'obtener el Handle del menu
hMenu = GetMenu(Me.hwnd)
'verifica que existe un menu
If hMenu = 0 Then
MsgBox "Este Form no tiene un menu!!"
Exit Sub
End If
'obtiene el primer sub-menu
hSubMenu = GetSubMenu(hMenu, 0)
'verifica que posea un sub-menu
If hSubMenu = 0 Then
MsgBox "Este Form no tiene un sub-menu!!"
Exit Sub
End If
SetMenuItemBitmaps hSubMenu, 0, MF_BYPOSITION, Picture1.Picture, Picture1.Picture
End Sub