偶的程序如下,其中image1.image2.image3为图标,运行时只能显示文字,不能显示图标。
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 _
nPositon As Long, ByVal wFlags As Long, ByVal hBitmapUnchecked As Long, ByVal hBitmapChecked _
As Long) As Long
Const MF_BYPOSITION = &H400&
Private Sub Form_Load()
Dim mHandle As Long, lRet As Long, sHandle As Long
mHandle = GetMenu(hwnd)
sHandle = GetSubMenu(mHandle, 0)
lRet = SetMenuItemBitmaps(sHandle, 0, MF_BYPOSITION, Image1.Picture, Image1.Picture)
lRet = SetMenuItemBitmaps(sHandle, 1, MF_BYPOSITION, Image2.Picture, Image2.Picture)
lRet = SetMenuItemBitmaps(sHandle, 3, MF_BYPOSITION, Image3.Picture, Image3.Picture)
End Sub