Results 1 to 12 of 12

Thread: How do you get icons next to menu items?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    How do you get icons next to menu items?

    I created great menus, but I can't figure out how to get icons next to the text! I am just using the built-in menu editor for a vb form.

    Is there another control I should be using (hopefully free!). Or am I just blind???

    Thanks in advance!
    ~seaweed

  2. #2
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    i searched the fourm and found this code:
    VB Code:
    1. Declare Function GetMenu Lib "user32" _
    2. (ByVal hwnd As Long) As Long
    3.  
    4. Declare Function GetSubMenu Lib "user32" _
    5. (ByVal hMenu As Long, ByVal nPos As Long) As Long
    6.  
    7. Declare Function GetMenuItemID Lib "user32" _
    8. (ByVal hMenu As Long, ByVal nPos As Long) As Long
    9.  
    10. Declare Function SetMenuItemBitmaps Lib "user32" _
    11. (ByVal hMenu As Long, ByVal nPosition As Long, _
    12. ByVal wFlags As Long, ByVal hBitmapUnchecked As Long, _
    13. ByVal hBitmapChecked As Long) As Long
    14.  
    15. Public Const MF_BITMAP = &H4&
    16.  
    17. Type MENUITEMINFO
    18. cbSize As Long
    19. fMask As Long
    20. fType As Long
    21. fState As Long
    22. wID As Long
    23. hSubMenu As Long
    24. hbmpChecked As Long
    25. hbmpUnchecked As Long
    26. dwItemData As Long
    27. dwTypeData As String
    28. cch As Long
    29. End Type
    30.  
    31. Declare Function GetMenuItemCount Lib "user32" _
    32. (ByVal hMenu As Long) As Long
    33.  
    34. Declare Function GetMenuItemInfo Lib "user32" _
    35. Alias "GetMenuItemInfoA" (ByVal hMenu As Long, _
    36. ByVal un As Long, ByVal b As Boolean, _
    37. lpMenuItemInfo As MENUITEMINFO) As Boolean
    38.  
    39. Public Const MIIM_ID = &H2
    40. Public Const MIIM_TYPE = &H10
    41. Public Const MFT_STRING = &H0&
    42.  
    43. Private Sub Command1_Click()
    44.  
    45. 'Get the menuhandle of your app
    46. hMenu& = GetMenu(Form1.hwnd)
    47.  
    48. 'Get the handle of the first submenu (Hello)
    49. hSubMenu& = GetSubMenu(hMenu&, 0)
    50.  
    51. 'Get the menuId of the first entry (Bitmap)
    52. hID& = GetMenuItemID(hSubMenu&, 0)
    53.  
    54. 'Add the bitmap
    55.  
    56. SetMenuItemBitmaps hMenu&, hID&, MF_BITMAP, _
    57. Picture1.Picture, _
    58. Picture1.Picture

  3. #3
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Go to http://www.vbthunder.com, and look for the menu icons example, if you want to to put 3D icons in your menus (like office 2000).
    Baaaaaaaaah

  4. #4
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    You could also send out stickers with the icons on them and have the users put the stickers on their monitor next to the menu... or not at all... they may find those little icons annoying... like me.

  5. #5
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Originally posted by DiGiTaIErRoR
    You could also send out stickers with the icons on them and have the users put the stickers on their monitor next to the menu... or not at all... they may find those little icons annoying... like me.
    I like to see/put the icons (3D or flat)next to the menu items.
    Baaaaaaaaah

  6. #6
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    You could make fancy embossed stickers!

  7. #7
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Originally posted by DiGiTaIErRoR
    You could make fancy embossed stickers!
    yah, yah...and what about those office xp like icons?
    Baaaaaaaaah

  8. #8
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    On stickers?!

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Thanks

    Im not sure about the sticker idea...would I have to make different size stickers depending on the users screen size and resolution?

    I understand your not liking icons, but I'm not just making a bunch of random icons for each menu item. I have one menu in which users can add smileys to their document, but instead of just having a list of smiley names (angry, happy, big grin, etc.) I think that would be an appropriate place to actually show the icon of the image they are inserting into their document.

    Thanks for all your help, guys!
    ~seaweed

  10. #10
    PowerPoster eiSecure's Avatar
    Join Date
    Jul 2000
    Location
    Texas
    Posts
    2,209
    Actually, I was wondering myself on how to make XP-style menus/toolbars/etc.

  11. #11
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Originally posted by eiSecure
    Actually, I was wondering myself on how to make XP-style menus/toolbars/etc.
    I don't know about menus but there is a button activex control that can be changes to a menu item. You can have shadowed picture and all other nice office xp menu effects.

    Search the NET because I forgot on which website it was.
    Baaaaaaaaah

  12. #12
    Hyperactive Member Hampster's Avatar
    Join Date
    Feb 2001
    Location
    On my hamster wheel.
    Posts
    374
    Wow, stickers.... I'm gonna try that ....
    And I'll make 'em so the user can't peal them off! Wow, why didn't Bill Gates think of this?

Posting Permissions

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



Click Here to Expand Forum to Full Width