Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to display GDI HBITMAP Handle?

Hello,
I got a GDI HBITMAP Handle (I32 number) , i know all image properties.
Is there any DLL or ocx that will convert the Handle to actual pixels (to array or to display on imaq window).
 
Tnx,
HaD
 
0 Kudos
Message 1 of 8
(6,612 Views)

Hi HaD,

I think it would be helpful if we could have a little more information about what it is you have.  For example what environment you are in.  Where is the image data coming from?

Adam H
National Instruments
Applications Engineer
0 Kudos
Message 2 of 8
(6,588 Views)
I start a video srteam from external camera. its done with some dll.
the dll also start a message to specific form.
this is the code in VB:
 

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)

' Do whatever custom processing you need for this message.

If (m.Msg = MyCameraStreamMessage) Then

If (m.WParam = cameraId) Then

'Dim myImage As Image

' myImage = Image.FromHbitmap(m.LParam)

MyPictureBox.Image = Image.FromHbitmap(m.LParam)

 

I tried the .NET "Image.FromHbitmap" in Labview but i got some unexplained error.

So i want to do that in conventional way, with VI or DLL that will convert the GDI Handle (m.Lparam) to pixels that i can process.

 

Tnx,

HaD

0 Kudos
Message 3 of 8
(6,578 Views)

Hi HaD,

if you use the advapi32.dll you can send messages to copy the image into the clipboard. Later you can read your picture from the clipboard and work with it in LabView.
If you use another way, you can use the "GetDIBits" function to get the size of the image and the "GetBitmapBits" function to get the real image. Both function are in the GDI32.dll.

Hope it helps.
Mike

0 Kudos
Message 4 of 8
(6,575 Views)
so if i know the size of the image i can use only GetBitmapBits?
 
0 Kudos
Message 5 of 8
(6,570 Views)
Hi HaD,
if you know the image size (means how many bytes the image has), then i think you can directly use the GetBitmapBits.
 
Hope it helps.
Mike
Message 6 of 8
(6,564 Views)

Hi Mike-

 

I've got a handle to a device dependent bitmap (converted from stdole.picture).  I'm not familiar with using the Windows API.  Any way to display the image referenced by HBITMAP (DDB type) in the LabVIEW picture control? Could you post an example subVI that does the conversion?  *thanks*


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
0 Kudos
Message 7 of 8
(5,717 Views)

Mike-

 

If you're like some of the others, you might cross over to Zealout before your 5000th post (either something with the new system or we can only see your cached post count).  So, congratulations in advance!

 

Thanks for any ideas, resources, etc.  (Again, I'm not familiar with the Windows API.)


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
0 Kudos
Message 8 of 8
(5,570 Views)