Tomado de
www.allapi.net
'Download the full source+pictures+.. at
http://www.allapi.net/php/redirect/r...download&id=13
Private Declare Function GetMenu Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As Any) As Long
Const MF_BITMAP = 4
Const MF_CHECKED = 8
Private Sub Form_Load()
'KPD-Team 1998
'URL:
http://www.allapi.net/
'E-Mail:
[email protected]
Dim hMenu As Long, hSubMenu As Long, lngID As Long
'Get the handle of the form's menu
hMenu = GetMenu(Me.hWnd)
'Get the handle of the form's submenu
hSubMenu = GetSubMenu(hMenu, 0)
'Change first item (index=0)
picBitmaps(0).Picture = picBitmaps(0).Image
lngID = GetMenuItemID(hSubMenu, 0)
Call ModifyMenu(hMenu, lngID, MF_BITMAP, lngID, CLng(picBitmaps(0).Picture))
'Change second item (index=1)
picBitmaps(1).Picture = picBitmaps(1).Image
lngID = GetMenuItemID(hSubMenu, 1)
Call ModifyMenu(hMenu, lngID, MF_BITMAP, lngID, CLng(picBitmaps(1).Picture))
'Change third item (index=2)
picBitmaps(2).Picture = picBitmaps(2).Image
lngID = GetMenuItemID(hSubMenu, 2)
Call ModifyMenu(hMenu, lngID, MF_BITMAP, lngID, CLng(picBitmaps(2).Picture))
mnuBitmap1.Checked = True
End Sub
Private Sub mnuBitmap1_Click()
mnuBitmap1.Checked = Not mnuBitmap1.Checked
End Sub
Private Sub mnuBitmapEnd_Click()
End
End Sub