Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Putting Bitmaps on 1 or more menu

Status
Not open for further replies.

kensheehimura1

Programmer
Jun 2, 2003
19
PH
good day,

Help pls.. i created a control that will put a bitmap on the menu of my visual basic application, i got a good result but i have one problem, ...because i have 3 menus(File,Edit,Help), but when i run the program only the "File" menu has the bitmap on it, the other 2 menu have not,

Public Sub LoadMenuBitmap()
Dim hMenuBar As Long
Dim hMenu As Long
Dim lngMenuItems As Long
Dim lngCurrMenuItem As Long

hMenuBar = GetMenu(Me.hwnd)

hMenu = GetSubMenu(hMenuBar, 0)

lngMenuItems = GetMenuItemCount(hMenu)

For lngCurrMenuItem = 0 To lngMenuItems - 1
If lngCurrMenuItem <> lngMenuItems - 2 Then
Call SetMenuItemBitmaps(hMenu, lngCurrMenuItem, MF_BYPOSITION, picIndia(lngCurrMenuItem), picIndia(lngCurrMenuItem))
End If
Next lngCurrMenuItem
End Sub

thanks,
 
I don't know exact how this API stuff works but I think that:

[For lngCurrMenuItem = 0 To lngMenuItems - '1]
tells your program to loop through the menuitems.(=OK)

[If lngCurrMenuItem <> lngMenuItems - 2 Then]
makes it stop at menuitem 0!!!(NOT OK)


Patrick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top