-
Nov 7th, 1999, 03:25 AM
#1
Thread Starter
Member
Hey, I've become rather fond of the Office97+ Menus, that include icons by the text in the menu. I'm aware it takes quite a bit of API code, but if someone could explain how to add/modify/remove icons from menu items, I would appreciate it.
------------------
(¯`·.¸¸.·´¯`·->ShadowCrawler<-·´¯`·.¸¸.·´¯)
Teenage Programmer
Visual Basic, HTML, C++, JavaScript
http://welcome.to/X12Tech
Email: craigkovatch@compuserve.com
ICQ#: 9872708
-
Nov 7th, 1999, 06:44 AM
#2
There isn't that much code to do it, here's an example:
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&
Private Sub Command1_Click()
Dim lMenu As Long
Dim lID As Long
'Add Menu Bitmap
lMenu = GetMenu(hwnd)
lMenu = GetSubMenu(lMenu, 0)
lID = GetMenuItemID(lMenu, 0)
Call SetMenuItemBitmaps(lMenu, lID, MF_BITMAP, Picture1.Picture, Picture1.Picture)
End Sub
Private Sub Command2_Click()
Dim lMenu As Long
Dim lID As Long
'Remove Menu Bitmap
lMenu = GetMenu(hwnd)
lMenu = GetSubMenu(lMenu, 0)
lID = GetMenuItemID(lMenu, 0)
Call SetMenuItemBitmaps(lMenu, lID, MF_BITMAP, 0, 0)
End Sub
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net
-
Nov 7th, 1999, 07:03 AM
#3
Thread Starter
Member
k, i got all of that but hwnd. what hwnd do I put in? the menu's hwnd?
------------------
(¯`·.¸¸.·´¯`·->ShadowCrawler<-·´¯`·.¸¸.·´¯)
Teenage Programmer
Visual Basic, HTML, C++, JavaScript
http://welcome.to/X12Tech
Email: craigkovatch@compuserve.com
ICQ#: 9872708
-
Nov 7th, 1999, 10:31 PM
#4
The Forms Hwnd, GetMenu retrieves the Menu Handle associated with the Window Handle, (Form Hwnd).
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net
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
|