| Code for adding a menu icon (menu bitmap) to your projects in VB. No longer do you have to have the boring blank spots in front of your menu items. Only 4 lines of 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 Private Const MF_BITMAP = &H4& 'Get menu from set form (Me.hwnd) hMenu = GetMenu(Me.hwnd) 'Get submenus from set menu (0 = 1st menu, 1 = 2nd menu, etc.) hSubMenu = GetSubMenu(hMenu, 0) 'Get submenu ID from set submenu (0 = 1st submenu, etc.) hID = GetMenuItemID(hSubMenu, 2) 'Set bitmap for the set menu, using the set submenu ID, a declaration used to set the bitmap, ' the picture to be displayed when unchecked, and the picture to be displayed when checked SetMenuItemBitmaps hMenu, hID, MF_BITMAP, picExit.Picture, picExit.Picture |
Code for adding a menu icon |
India web developer web development India | Freelance web development ecommerce web developer | Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design