Obtaining a bitmap handle (HBITMAP)

G

George

I am creating a Bitmap as follows:

Bitmap b = new Bitmap("mypic.gif");

I am using P/Invoke and need to send a message (SendMessage()) with an
HBITMAP as a parameter. The Bitmap class doesn't seem to provide the
HBITMAP (at least not in CF). Can anyone tell me the easiest (and
hopefully simplest) way to obtain the handle? Any code snippets would
be greatly appreciated.

thanks,
George
 
G

George

The BitmapEx class' only meaningful constructor (and the only way to
really get a bitmap handle) requires a bitmap file. I am reading from
a stream (originating from a compressed archive), so I can't provide a
file name. Is there another way to do it? Thanks - George
 
G

Guest

I assumed you were using a file from the sample code you gave. I don't know
off hand if you can get a handle to the bitmap. A work around would be
saving the bitmap stream to a file and open it using BitmapEx.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top