There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Software Development
Tag Cloud
audio blue screen boot bsod computer cpu crash dell desktop driver drivers error excel external hard drive firefox freezes freezing hard drive hardware hijackthis internet internet explorer itunes laptop mac malware motherboard mouse network networking outlook 2007 power printer problem ram restart router screen slow sound trojan usb virus vista vista 32-bit windows windows xp winxp wireless wmp
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
PopupMenu BMPs...


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
tim8w's Avatar
Member with 35 posts.
 
Join Date: Nov 2004
Experience: New VB6 Programmer
15-Dec-2004, 06:03 PM #1
Unhappy PopupMenu BMPs...
How do you add BMPs to a PopupMenu? I tried doing the same thing you do for standard menus and this does not work. Any ideas?

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
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Private Declare Function GetMenuItemInfo Lib "user32" Alias "GetMenuItemInfoA" (ByVal hMenu As Long, ByVal un As Long, ByVal b As Boolean, IpMenuItemInfo As MENUITEMINFO) As Boolean

Private Type MENUITEMINFO
    cbSize As Long
    fMask As Long
    fState As Long
    wID As Long
    hSubMenu As Long
    hbmpChecked As Long
    hbmpUnchecked As Long
    dwItemData As Long
    dwTypeData As String
    cch As Long
End Type

Private Const MIIM_ID = &H2
Private Const MIIM_TYPE = &H10
Private Const MFT_STRING = &H0&
Private Const MF_BITMAP = &H0&


Dim hMenu As Long, hSubMenu As Long, hID As Long
    
'Get the Menuhandle of the form
hMenu = GetMenu(frmMain.hwnd)
    
'Get the handle of the PopupMenu submenu
hSubMenu = GetSubMenu(hMenu, 0)
        
hID = GetMenuItemID(hSubMenu, 0)
SetMenuItemBitmaps hMenu, hID, MF_BITMAP, imgMenuItem(0).Picture, imgMenuItem(0).Picture
hID = GetMenuItemID(hSubMenu, 1)
SetMenuItemBitmaps hMenu, hID, MF_BITMAP, imgMenuItem(0).Picture, imgMenuItem(0).Picture
hID = GetMenuItemID(hSubMenu, 2)
SetMenuItemBitmaps hMenu, hID, MF_BITMAP, imgMenuItem(1).Picture, imgMenuItem(1).Picture
Thanks,
Tim
Glaswegian's Avatar
Computer Specs
Distinguished Member with 3,084 posts.
 
Join Date: Dec 2004
Location: Erm...Glasgow?
Experience: of what?
22-Dec-2004, 12:00 PM #2
Based on the API calls in your post, have you looked at Ivan Moala's site for this kind of thing?
HTH

Regards
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 10:08 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.