icon in menu
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: icon in menu

  1. #1
    Join Date
    May 2002
    Location
    Huntington, WV
    Posts
    303

    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.

  2. #2
    Join Date
    Feb 2002
    Location
    Chennai, India
    Posts
    45
    Using API u can acheive, the following are API's which can be use to create menu's with icons.

    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

    If you are not able to proceed further, I can send u a sample project.


    mohideen

  3. #3
    Join Date
    May 2002
    Location
    Huntington, WV
    Posts
    303
    could you send me the sample, cause i don't know how to actually use that to put specific icons in specific menus

  4. #4
    Join Date
    Feb 2002
    Location
    Chennai, India
    Posts
    45
    This sample which i have downloaded from somesite and modified few lines. Hope this would solve the pblm.
    Attached Files Attached Files

  5. #5
    Join Date
    May 2002
    Location
    Huntington, WV
    Posts
    303
    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.

  6. #6
    Join Date
    Feb 2002
    Location
    Chennai, India
    Posts
    45
    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.

    mohideen

  7. #7
    Join Date
    May 2002
    Location
    Huntington, WV
    Posts
    303
    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.

  8. #8
    Join Date
    Apr 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    1,792
    That's a really nifty little project!!! Thanks for posting it.

  9. #9
    Join Date
    May 2002
    Location
    Huntington, WV
    Posts
    303
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)