Solved

Using bitmaps in menu items

Posted on 1998-07-22
5
152 Views
Last Modified: 2010-05-03
How do you use the API in order to attach bitmap images to items in a drop down menu?
0
Comment
Question by:rossom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
jjmartin earned 50 total points
ID: 1466411
Here is some code that will add the bitmaps to your menu.

 Dim i%
  Dim hMenu, hSubMenu, menuID, x
  hMenu = GetMenu(hwnd)
  hSubMenu = GetSubMenu(hMenu, 0) '1 for "Other" menu etcetera
  For i = 1 To 4
    menuID = GetMenuItemID(hSubMenu, i - 1)
    x = SetMenuItemBitmaps(hMenu, menuID, &H4, img.ListImages(i).Picture, img.ListImages(i).Picture)
  Next
  menuID = GetMenuItemID(hSubMenu, 5)
  x = SetMenuItemBitmaps(hMenu, menuID, 0, img.ListImages(5).Picture, 0&)
0
 
LVL 7

Expert Comment

by:tward
ID: 1466412
This doesn't seem to work?
0
 
LVL 3

Expert Comment

by:jjmartin
ID: 1466413
It works on my PC running VB5, where is the code failing on you?
0
 
LVL 7

Expert Comment

by:tward
ID: 1466414
 x = SetMenuItemBitmaps(hMenu, menuID, &H4, img.ListImages(i).Picture, img.ListImages(i).Picture)

seems to be returning 0?

I cut your code out to see if it would work so it is exactly as above!

0
 
LVL 7

Expert Comment

by:tward
ID: 1466415
Sorry,

  It does work here also, I had ICONS in the ImageList instead of Bitmaps.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question