Вы находитесь на странице: 1из 1

Private Type MENUITEMINFO

cbSize As Long
fMask As Long
fType As Long
fState As Long
wid As Long
hSubMenu As Long
hbmpChecked As Long
hbmpUnchecked As Long
dwItemData As Long
dwTypeData As Long
cch As Long
End Type
Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPo
s As Long) As Long
Private Declare Function SetMenuItemInfo Lib "user32" Alias "SetMenuItemInfoA" (
ByVal hMenu As Long, ByVal un As Long, ByVal bypos As Long, lpcMenuItemInfo As M
ENUITEMINFO) As Long
Private Const MF_BITMAP = &H4&
Private Const MFT_BITMAP = MF_BITMAP
Private Const MIIM_TYPE = &H10
Private Sub Form_Load()
' Set the menu bitmaps.
SetMenuBitmap Me, Array(0,
menu
SetMenuBitmap Me, Array(1,
SetMenuBitmap Me, Array(1,
SetMenuBitmap Me, Array(1,
SetMenuBitmap Me, Array(1,
End Sub
' Put a bitmap in a menu item.
Public Sub SetMenuBitmap(ByVal
pic As Picture)
Dim menu_handle As Long
Dim i As Integer
Dim menu_info As MENUITEMINFO

0), imgExit.Picture

'Picture Areas in

0), imgDelete.Picture
1, 0), imgStop.Picture
1, 1), imgYield.Picture
1, 2), imgCaution.Picture
frm As Form, ByVal item_numbers As Variant, ByVal

' Get the menu handle.


menu_handle = GetMenu(frm.hwnd)
For i = LBound(item_numbers) To UBound(item_numbers) - 1
menu_handle = GetSubMenu(menu_handle, item_numbers(i))
Next i
With menu_info
.cbSize = Len(menu_info)
.fMask = MIIM_TYPE
.fType = MFT_BITMAP
.dwTypeData = pic
End With
SetMenuItemInfo menu_handle, item_numbers(UBound(item_numbers)), True, menu_
info
End Sub

Вам также может понравиться