我的程式如下,其中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
我的程式如下,其中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