How to put a Icon in a Menu bar

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nurikoAnna
    New Member
    • Nov 2008
    • 26

    How to put a Icon in a Menu bar

    Good day guyzz...


    I want to put an icon in a menu bar ??/ It it possible???

    Please help me guyzz....
  • smartchap
    New Member
    • Dec 2007
    • 236

    #2
    If you are using a toolbar goto its properties (by right clicking on it) and set icons for the items.

    Comment

    • nurikoAnna
      New Member
      • Nov 2008
      • 26

      #3
      I'm not using tool bar..just using menu...

      how to put an icon in a menu???

      Comment

      • 9815402440
        New Member
        • Oct 2007
        • 180

        #4
        hi
        declare following api functions in the form
        Option Explicit

        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 ModifyMenu Lib "user32" Alias "ModifyMenu A" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As String) As Long
        Private Declare Function SetMenuItemBitm aps Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal hBitmapUnchecke d As Long, ByVal hBitmapChecked As Long) As Long

        Private Declare Function GetMenuCheckMar kDimensions Lib "user32" () As Long

        Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
        Private Declare Function CreateCompatibl eDC Lib "gdi32" (ByVal hdc As Long) As Long
        Private Declare Function CreateCompatibl eBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
        Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long

        Private Declare Function CreateBitmap Lib "gdi32" (ByVal nWidth As Long, ByVal nHeight As Long, ByVal nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As Long
        Private Declare Function GetDesktopWindo w Lib "user32" () As Long
        Private Declare Function PatBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal dwRop As Long) As Long

        Private Declare Function GetSystemMetric s Lib "user32" (ByVal nIndex As Long) As Long

        add an image list control in the form and name it imgPictures
        insert the required pictures in the imgPictures

        now add the following code in form_load event

        Dim i%
        Dim hMenu, hSubMenu, menuID, x
        hMenu = GetMenu(hwnd)
        hSubMenu = GetSubMenu(hMen u, 0)
        For i = 1 To 4
        menuID = GetMenuItemID(h SubMenu, i - 1)
        x = SetMenuItemBitm aps(hMenu, menuID, &H4, imgPictures.Lis tImages(i).Pict ure, imgPictures.Lis tImages(i).Pict ure)
        Next
        menuID = GetMenuItemID(h SubMenu, 5)
        x = SetMenuItemBitm aps(hMenu, menuID, 0, imgPictures.Lis tImages(5).Pict ure, 0&)

        regards
        manpreet singh dhillon hoshiarpur

        Comment

        • debasisdas
          Recognized Expert Expert
          • Dec 2006
          • 8119

          #5
          please check this.

          that might be helpful to you.

          Comment

          Working...