|
-
Sep 25th, 2002, 06:20 AM
#1
Thread Starter
New Member
Perfect Code To Have Menu Icon
I NEED FULL CODE TO ADD AN ICON TO THE LEFT OF ANY MENU ITEM. ALSO SUGGEST HOW TO CREATE XP LIKE MENUS.
THANKING, GOODBYE.
-
Sep 25th, 2002, 07:34 AM
#2
-
Sep 25th, 2002, 03:38 PM
#3
Software Eng.
The SetMenuItemBitmaps function should do it.
-
Sep 25th, 2002, 03:45 PM
#4
Software Eng.
I lost my example, so here's an example from AllApi.
VB Code:
'This project needs a form with a menu with at least one submenu
'It also needs a picturebox, Picture1, that contains a small b/w bitmap
Const MF_BYPOSITION = &H400&
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
Private Sub Form_Load()
'KPD-Team 2000
Dim hMenu As Long, hSubMenu As Long
'get the handle of the menu
hMenu = GetMenu(Me.hwnd)
'check if there's a menu
If hMenu = 0 Then
MsgBox "This form doesn't have a menu!"
Exit Sub
End If
'get the first submenu
hSubMenu = GetSubMenu(hMenu, 0)
'check if there's a submenu
If hSubMenu = 0 Then
MsgBox "This form doesn't have a submenu!"
Exit Sub
End If
'set the menu bitmap
SetMenuItemBitmaps hSubMenu, 0, MF_BYPOSITION, Picture1.Picture, Picture1.Picture
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|