Icons in menu

Hey guys I am trying very hard to put icons in my menus but it just isn't working.  My app puts an icon in the System tray and has a popup menu come out of it when it's clicked.  I have this code I got from another question but it dosn't seem to work.

    Dim hTopMenu&, hSubMenu&, menuID&, rc&
    hTopMenu = GetMenu(Me.hwnd)
    hSubMenu = GetSubMenu(hTopMenu, 0)
    menuID = GetMenuItemID(hSubMenu, 0)
    rc = SetMenuItemBitmaps (hTopMenu, menuID, MF_BYCOMMAND, imgInfo.Picture, imgInfo.Picture)

I am running windows 95 with IE 5.0 and VB 6.0.

Thanks for any and all help.
RaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vettrangerCommented:
Go to :

http://www.vbaccelerator.com/

Then select the Controls menu option.

Then select Icon Menu Control.

This is a freeware control and does a very nice job.

0
JuiletteCommented:

' Remarks:
' open a new app...add a picture box and a command button
' build a menu with menu editor
' add a bitmap pic to the picture box 13 x 13
' NOT an icon...a bitmap
' if you don't want to make bitmaps there is a freeware icon extractor
' at the site below which will save Icons as bitmaps
' therefore you can use the icon once you convert it to a bitmap

' http://www.ozemail.com.au/~jaesenj/software.html
'
' this will add the pic to your menu item
'
'
'<<<<<  put his code in a bas module  >>>>>>>>>
 
Public Declare Function GetSubMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPos As Long) As Long
Public Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long

Public 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



Public Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long

Public Declare Function GetMenuItemInfo Lib "user32" Alias "GetMenuItemInfoA" (ByVal hMenu As Long, ByVal un As Long, ByVal b As Boolean, lpMenuItemInfo As MENUITEMINFO) As Boolean



Public Const MIIM_ID = &H2
Public Const MIIM_TYPE = &H10
Public Const MFT_STRING = &H0&
Public Const MF_BITMAP = &H4&

Type MENUITEMINFO
    cbSize As Long
    fMask As Long
    fType As Long
    fState As Long
    wID As Long
    hSubMenu As Long
    hbmpChecked As Long
    hbmpUnchecked As Long
    dwItemData As Long
    dwTypeData As String
    cch As Long
End Type
'
' <<<<<<<< put this code in the event you wish to use  >>>>>>>>
'
'Get the menuhandle of your app
hMenu& = GetMenu(Form1.hwnd)

'Get the handle of the first submenu (Hello)
hSubMenu& = GetSubMenu(hMenu&, 0)

'Get the menuId of the first entry (Bitmap)
hID& = GetMenuItemID(hSubMenu&, 0)

'Add the bitmap
SetMenuItemBitmaps hMenu&, hID&, MF_BITMAP, Picture1.Picture, Picture1.Picture

'You can add two bitmaps to a menuentry one for the checked and one for 'the unchecked state.

'Wayne
0
RaAuthor Commented:
Sorry vettranger, but I really don't want any extra controls in this.  I want to keep the size to a minumium.

Juilette, I'll test your code later today and post a comment as to weather or not it works.  One thing I want to ask you is why only Bitmaps???  If I load all my icons into image controls at design time, what does it matter what they were?  VB will save them to the .frx file in it's own format, doesn't it?

Thanks for the quick responses guys.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

JuiletteCommented:
Ra:
Can't answer that for you...I got the code off the net somewhere...I just use the icon extractor mentioned and convert them...it's not biggie for me...Your situation might be different.

Wayne
0
RaAuthor Commented:
vettranger, I just checked out that control at VBAcceleator.com and it did so much stuff for me that I decided to use it.  Please repost your answer as an answer and I'll give you the points.  Sorry about the rejection before. I didn't know that control would do so much.

Thanks for the help

-------
Juilette, I couldn't get the code you gave me to work anyway. (One of the reasons I want to use the control now.)  Thanks for trying.
0
vettrangerCommented:
Here it is, and I'm delighted that the suggested control was helpful! :-D
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RaAuthor Commented:
Thanks again vettranger, and sorry for the rejection.

To everybody that reads this and can't figure out what happened, the rejected answer is the accepted answer.  I jumped the gun and rejected it before I knew the control was so cool.  It did more then I have ever seen before, and it's free!!!!  It would take a lot of API stuff and other coding to replace it.
0
vettrangerCommented:
No problem, that's a good control but it does take a while to scope it all out! LOL
0
JuiletteCommented:
No problem, it was just a suggestion.

However, I wish people would check things out before they comment on the fact that a code doesn't work.

....FYI...the code I posted works fine...it's simply a read, cut and paste operation....no biggie!

Wayne
0
MoondancerCommented:
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.