Results 1 to 4 of 4

Thread: how can I add Icons in the Menus

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2001
    Location
    NEW DELHI
    Posts
    18

    Exclamation how can I add Icons in the Menus

    Can any body help in how can I add icons in the Menubars in VB.

  2. #2
    Matthew Gates
    Guest
    Take a look at this link.
    http://www.vbsquare.com/tips/tip158.html

  3. #3
    Megatron
    Guest
    Use the SetMenuItemBitmaps function.
    Code:
    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 GetMenuItemID 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
    Const MF_BITMAP = &H4&
    
    Private Sub Command1_Click()
    
        Dim hMenu As Long, hSub As Long, ItemID As Long
        hMenu = GetMenu(Me.hwnd)
        hSub = GetSubMenu(hMenu, 0)
        ItemID = GetMenuItemID(hSub, 0)
        SetMenuItemBitmaps hMenu, ItemID, MF_BITMAP, Picture1, Picture1
    
    End Sub

  4. #4
    Megatron
    Guest
    I forgot to mention, the bitmaps must be 13x11 pixels in size.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width