给菜单加图标
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 Const MF_BYPOSITION = &H400&
Private Sub Form_Load()
Dim hmenu As Long, bmpmenu As Long
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
hmenu = GetMenu(Me.hwnd)
nmenu = GetSubMenu(hmenu, 0)
bmpmenu = SetMenuItemBitmaps(nmenu, 0, MF_BYPOSITION, Image1, Image1)
End Sub
效果如图: