How to add bitmaps to pulldown menu items?

This is a discussion on How to add bitmaps to pulldown menu items? within the Windows Programming forums, part of the Platform Specific Boards category; Hello everyone, I am trying to figure out how to add bitmaps next to pulldown menu items. These could be ...

  1. #1
    Registered User
    Join Date
    Apr 2010
    Location
    hellertown, pennsylvania
    Posts
    24

    How to add bitmaps to pulldown menu items?

    Hello everyone,

    I am trying to figure out how to add bitmaps next to pulldown menu items. These could be standard images such as the classical opened file image for "file open" toolbar button, or custom bitmaps. I would be happy to find a tutorial on the subject, or better still, some example code. MSDN library gives no information on this subject that I could discover and I found next to nothing about it via Google. But, there are lots and lots of WINDOWS apps out there that add this nice finishing touch and I'd like to know how to do it.

    I am compiling using MinGW gcc, not using Visual Studio/VCE, and not doing C++ either, just plain old C.

    Regards,
    Mark Allyn

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Look up "Owner Drawn" controls... menus etc.

    The base Windows API provides for you to manually draw any control element.

  3. #3
    Registered User
    Join Date
    Apr 2010
    Location
    hellertown, pennsylvania
    Posts
    24
    Hello Commentater,

    Spent yesterday studying your suggestion. Looked at a bunch of C++ code illustrating how to do owner draw menus. I don't code in C++ so these examples were not very useful, but I have to admit they certainly could produce thrilling menus. I did find one MSFT tute in C and I'll have to look at it more carefully. Generally, a discouraging and overly long outing on the internet.

    However, I did find a rough solution using the SetMenuItemBitmaps API. All it requires is to load a Bitmap and take a handle to it and use it in the SetMenuItemBitmaps() function. Works fine. I'll admit it doesn't produce an astonishingly brilliant menu, but it works.

    Regards,
    Mark Allyn

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Glad you got something going on...

    Have you seen the Forger's Tutorial
    And how about Catch22

    Both have been exceptionally helpful to me over the years..

  5. #5
    Registered User
    Join Date
    Apr 2010
    Location
    hellertown, pennsylvania
    Posts
    24

    Forger and Catch22

    Good morning, Commentator,

    As a matter of fact, I had consulted Forger more than once over the years, but I hadn't ever paid attention to the name. So, when I turned up the link you sent I was surprised to see a familiar face.

    As for Catch22--you're right! Lots of interesting material here, especially on subclassing.

    Thanks and Regards,
    Mark Allyn

  6. #6
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,625
    Quote Originally Posted by allynm View Post
    Good morning, Commentator,
    Wow, that's the best anagram of Tater's name I've ever seen!
    Devoted my life to programming...

  7. #7
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by GReaper View Post
    Wow, that's the best anagram of Tater's name I've ever seen!
    All this time and nobody gets the joke...

    Common Tater ... image couch potato ...

    Say it out loud... Commontater... commentator.

    signature... //tater ... comment tater ... commentator

    That's been my username all along... Mark's the first to actually figure it out.


    (And people wonder why I tag this place as humourless...)
    Last edited by CommonTater; 01-08-2012 at 12:46 PM.

  8. #8
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Actually, I got it, first time I saw your name. I thought "Common Potato?", no, oh Commontator, OK.

    Seemed obvious.

  9. #9
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Adak View Post
    Actually, I got it, first time I saw your name. I thought "Common Potato?", no, oh Commontator, OK.

    Seemed obvious.
    Well, a joke only works if it's obvious...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Links to menu items
    By Olidivera in forum Windows Programming
    Replies: 1
    Last Post: 05-29-2005, 11:38 PM
  2. menu items check
    By Devil Panther in forum Windows Programming
    Replies: 19
    Last Post: 12-10-2004, 02:03 AM
  3. Disable menu items.
    By Bajanine in forum Windows Programming
    Replies: 4
    Last Post: 05-14-2004, 09:48 AM
  4. Checkmarked menu items
    By -leech- in forum Windows Programming
    Replies: 3
    Last Post: 02-25-2002, 04:21 PM
  5. Enabling menu items
    By chomper in forum Windows Programming
    Replies: 2
    Last Post: 02-20-2002, 07:43 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21