Page 180 - DCAP408_WEB_PROGRAMMING
P. 180
Windows Programming
Notes ByVal hBitmapChecked As Long) As Long
Private Declare Function GetMenuItemID Lib “user32” (ByVal hMenu As Long,
ByVal nPos As Long) As Long
Private Sub Form_Load()
Dim hMenu As Variant
Dim hSubMenu As Variant
Dim MenuID As Variant
Dim lX As Variant
VB6_API_frmCreateMenuBitmaps.BorderStyle = vbSizableToolWindow
VB6_API_frmCreateMenuBitmaps.Caption = “ Create Menu Bitmaps ”
VB6_API_frmCreateMenuBitmaps.BackColor = Color_Green
hMenu = GetMenu(VB6_API_frmCreateMenuBitmaps.hwnd)
hSubMenu = GetSubMenu(hMenu, 0)
MenuID = GetMenuItemID(hSubMenu, 0)
lX = SetMenuItemBitmaps(hMenu, MenuID, &H4, _
ImgLst.ListImages(1).Picture, ImgLst.ListImages(1).Picture)
MenuID = GetMenuItemID(hSubMenu, 1)
lX = SetMenuItemBitmaps(hMenu, MenuID, &H4, _
ImgLst.ListImages(2).Picture, ImgLst.ListImages(2).Picture)
MenuID = GetMenuItemID(hSubMenu, 2)
lX = SetMenuItemBitmaps(hMenu, MenuID, &H4, _
ImgLst.ListImages(3).Picture, ImgLst.ListImages(3).Picture)
End Sub
Private Sub mnuExit_Click()
Dim MsgResult As VbMsgBoxResult
MsgResult = MsgBox(“ You Choose Menu “ & mnuExit.Caption & “ Do you want to
exit form ? “, vbQuestion + vbYesNo, “ Create Menu Bitmaps With VB6 API ”)
If MsgResult = vbYes Then
End
End If
End Sub
Private Sub mnuNew_Click()
MsgBox “ You Choose Menu ” & mnuNew.Caption, vbOKOnly, “ Create Menu Bitmaps
With VB6 API ”
End Sub
Private Sub mnuOpen_Click()
MsgBox “ You Choose Menu ” & mnuOpen.Caption, vbOKOnly, “ Create Menu
Bitmaps With VB6 API ”
End Sub
174 LOVELY PROFESSIONAL UNIVERSITY