LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Access to BITMAPINFO and BITNMAPINFO in Wndows API

I have this case in which a camera driver sent an event when a live image is provided by camera (live image). In this case the com component driver forwards a pointer to BITMAPINFO structure (this structure is part of Windows API). The BITMAPINFO structure contains BITMAPEINFOHEADER and bitmap data (see: http://msdn.microsoft.com/en-us/library/aa921550.aspx ). The camera SDK designer indicated that after I receive the pointer to BITMAPINFO, to set to 1 the parameter biPlanes of the BITMAPINFOHEADER (see the BITMAPINFOHEADER structure: http://msdn.microsoft.com/en-us/library/dd318229%28v=VS.85%29.aspx ). Leter on I have to access the call GetObject from the gdi32.dll which will provide the resolution of the image for showing the live image.

My problem is how to access the BITMAPINFO or BITMAPINFOHEADER for modifying them. What Window API or component can provide an access to them from Labview?

I do not know if this question fits to this site.

Thank you,

Virginia

0 Kudos
Message 1 of 4
(2,752 Views)

Well you talk about COM so do you have an ActiveX component? If so the challenge will be simply to let LabVIEW use the right parameter type for your pointer. It should be an uInt32 on 32 bit LabVIEW and an uInt64 on 64 bit LabVIEW. Best would be if it would use the pointer sized integer type available since LabVIEW 8.6.

 

Then you take that pointer and copy the amount of data into a buffer. If your API provides you with a parameter how long the actual memory buffer is to which your pointer points then you are done with this part. Otherwise you have first to copy the BITMAPINFOHEADER into a buffer, analyze it to determine the color palette and actual bitmap size and copy that part also out of it.

 

Once you have the buffer (typically you use an array of bytes for that) you have to index and interprete the various data at the correct offset in that buffer.

 

In conclusion, it's all doable but if this is your first endaviour into Windows API programming your going to have a hell of a learning curve to go through and are likely to not get a fully working solution anytime soon. In that case I would recommend you to call in the help of some professional with some more experience in this area possibly even hiring someone. It may seem costly but unless you are a student and your time does not cost anything it will be always cheaper in the end.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 4
(2,737 Views)

Hi Rolf,

I understood partially what you explained because if you look at my original email my question is was how can I access in Labview the BITMAPINFOHEADER components (in particular the biPlanes to be set to 1 otherwise the GetObject from gdi32.dll will fail to get the bitmap handle)? Is there any Windows API dll or a Window component that can access this BITMAPINFOHEADER?

Tahnk you,

Virginia

0 Kudos
Message 3 of 4
(2,716 Views)

 


@Virginia Solomon wrote:

Hi Rolf,

I understood partially what you explained because if you look at my original email my question is was how can I access in Labview the BITMAPINFOHEADER components (in particular the biPlanes to be set to 1 otherwise the GetObject from gdi32.dll will fail to get the bitmap handle)? Is there any Windows API dll or a Window component that can access this BITMAPINFOHEADER?

Tahnk you,

Virginia


You don't need a Windows API for that. Depending on the way you get the pointer into your application you might already get a ActiveX refnum that you might simply have to convert into a byte array or you might only get the pointer itself as an integer. In the second case you would have to use a function like MoveBlock to copy the information from within this pointer into a newly created byte array. If you look for MoveBlock here in the forum you will find a number of topics some with examples too, and quite a few from me, that will tell you more about how to do that.

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 4
(2,711 Views)