getting a StdPicture (BMP) for a HICON (Icon Handle)

getting a StdPicture (BMP) for a HICON (Icon Handle)

Post by simon ry » Sat, 01 Feb 2003 22:42:46



I have a handle to an icon loaded from a file (let's say WORD, de document
icon). what i need now is a StdPicture Object which represents a BMP
containing that Icon i got the handle for. I need this StdPicture for the
API function SetMenuItemBitmaps 'cause i want to insert the icon into a
menu.
What i tryed is to load the icon into a picturebox and using the Picture
property of it for the function but that doesn't work. It works when i load
a BMP into to pictureBox and pass this to the SetMenuItemBitmaps function...

any ideas how i can manage the problem??

thank's
simon

 
 
 

getting a StdPicture (BMP) for a HICON (Icon Handle)

Post by Mike D Sutto » Sat, 01 Feb 2003 23:18:42


Quote:> I have a handle to an icon loaded from a file (let's say WORD, de document
> icon). what i need now is a StdPicture Object which represents a BMP
> containing that Icon i got the handle for. I need this StdPicture for the
> API function SetMenuItemBitmaps 'cause i want to insert the icon into a
> menu.
> What i tryed is to load the icon into a picturebox and using the Picture
> property of it for the function but that doesn't work. It works when i
load
> a BMP into to pictureBox and pass this to the SetMenuItemBitmaps

function...

You don't need a StdPicture object, but the Bitmap handle (A StdPicture
object requires more work)
Have a look at this post:
http://groups.google.com/groups?selm=O8Adu1vuCHA.2592%40TK2MSFTNGP10
Remember though that SetMenuItemBitmaps() should only be used to set
monochrome bitmap's (I.e. the mask of the icon), if you want colour bitmap's
then see the rest of the above thread for alternative methods.
Hope this helps,

    Mike

 -- EDais --

 - Microsoft Visual Basic MVP -
WWW: Http://EDais.earlsoft.co.uk/



 
 
 

1. Getting a windows hIcon (Icon Handle)

If i know the hWnd of a window, how can i go about getting the hIcon for
that window?

I think the way is through GetClassInfoEx, is this right?? The only problem
then becomes, GetClassInfoEx needs the hInstance of the window. So how do i
go about getting that?

Any help on this would be greatly appreciated. TIA -

Aaron


2. Schematics program or source needed

3. Hdc Fro StdPicture.Handle?

4. texture size

5. stdPicture Icon to File

6. Please recommend a 36 bit scanner

7. Getting a handle on total RAM use

8. MPEG for Mac Info

9. getting a handle on textures

10. Getting Handle to a region [GDI with VB]

11. Getting a handle to the Tooltips control

12. Help! Getting Metafile Handle From Picture Box

13. Getting the handle of ShellExecute