June 20th, 2002, 08:52 PM
icon in menu
what's the simplest way of adding icons to menus? i've tried several things from several different sites and can't get a single one to work. i always get some error, either that i don't have the proper license or variable not defined cause there's aways code in the project referring to an object that's not even there. all i want to do is add icons to my menus, nothing fancy, no specialo menu highlighting or coloring or anything, i just need icons.
June 21st, 2002, 12:23 AM
Using API u can acheive, the following are API's which can be use to create menu's with icons.
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
If you are not able to proceed further, I can send u a sample project.
June 21st, 2002, 02:14 AM
could you send me the sample, cause i don't know how to actually use that to put specific icons in specific menus
June 21st, 2002, 03:03 AM
This sample which i have downloaded from somesite and modified few lines. Hope this would solve the pblm.
June 21st, 2002, 05:10 PM
thanks, it works. but is there any any way of not making the icons reverse color when you go over the menus? cause it looks really ugly.
June 22nd, 2002, 12:26 AM
I need to explore and find out whether it is possilbe. ( I would notify, as soon as i get the solution). Any way thanks for your rating.
June 22nd, 2002, 06:53 PM
have you ever used any of those custom menu controls from other sites that let you use icons (whose colors aren't reversed when you mouseover them) ,set background pictures or colors, and more stuff like that? if so have you been able to get any to work, cause i know i haven't.
oh and that'd be great if you could notify me if you find out how to get the colors to stay the same using that code that you attached.
June 23rd, 2002, 06:46 PM
That's a really nifty little project!!! Thanks for posting it.
June 25th, 2002, 02:00 AM
how do i alter the code so that i don't hafat rename all my menus like s1m2, s2m2, etc? so that instead i can use like filenew and fileopen, confusing when the menu names aren't explanatory.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!