Subject: Creating Menu Icons
Posted By: sureshkumarct Post Date: 1/22/2006 11:53:02 PM
Please tell me how u can create icons to the left of menu
items in a VB Application.such menu icons can be seen in
applications like MS Word

Reply By: ChinaWolf Reply Date: 1/23/2006 3:26:43 AM
definde function API .

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
Now we can add icon to menu.
'ÏÂÃæÊdzÌÐò¿ªÊ¼¡£
Dim sHandle As Long, mHandle As Long
mHandle = GetMenu(frm.hwnd)           'get handle of the menu
sHandle = GetSubMenu(mHandle, 0)      'get handle of submenu
SetMenuItemBitmaps sHandle, 0, &H400&, img.ListImages(1).Picture, img.ListImages(1).Picture
'add icon
'we add an icon to menu from imglist,well you can add icon from picturebox or imagebox.

Reply By: ChinaWolf Reply Date: 1/23/2006 3:28:37 AM
Const MF_BYPOSITION = &H400&
This is constant define,sorry,I forgot!


Go to topic 38956

Return to index page 388
Return to index page 387
Return to index page 386
Return to index page 385
Return to index page 384
Return to index page 383
Return to index page 382
Return to index page 381
Return to index page 380
Return to index page 379