LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RGBQUAD issue

With the entire program commented out except these few lines, this works like a charm with LabVIEW.  Unfortunately there is a snag when I actually implement it.  Here is the VC++ error:
 

------ Build started: Project: PCIcameraSDK, Configuration: Debug Win32 ------
Compiling...
camera.cpp
c:\Documents and Settings\General\My Documents\Visual Studio Projects\PCIcameraSDK\camera.cpp(228) : error C2664: 'CImageData::SetBmpInfo' : cannot convert parameter 1 from 'BITMAPINFO *' to 'BITMAPINFO *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Build log was saved at "file://c:\Documents and Settings\General\My Documents\Visual Studio Projects\PCIcameraSDK\Debug\BuildLog.htm"
PCIcameraSDK - 1 error(s), 0 warning(s)

---------------------- Done ----------------------
    Build: 0 succeeded, 1 failed, 0 skipped

It seems like when it calls the SetBmpInfo(BITMAPINFO*) function from PCClib.dll, it expects the old definition of the BITMAPINFO structure and it cannot handle it when I make this redefinition.
0 Kudos
Message 11 of 14
(1,112 Views)
Chaos, all of the documentation on saving bmp files that I've read over the weekend use a similar BITMAPINFO redefinition so I'm sure that it works.  Although it seems that setting biBitCount to 8 should force bmicolors to have 256 members, as this is what was hinted in MSDN.  However, the problem now lies in casting it so my SaveBmpInfo function can take the file type.  Again, I'm a bit of a beginner with this C++ and Windows programming stuff, so I'm lost as far as this is concerned.  Anyone have any ideas on how to force the function to take this data type?  Thanks for the help.
0 Kudos
Message 12 of 14
(1,103 Views)
Yeah sorry for not jumping back into this.  I am not a big fan of C or C++ (because of casting issues frankly) and was hoping someone else might jump in the fray.  I think the language itself is very good but I cant stand the casting which is why I moved over to assembly.  The individual instructions are, at first, a little tough to wrap your thinking around but it has advantages 😃
 
Perhaps declaring as this will fix the issues:
typedef struct tagBITMAPINFO { // bmi 
   BITMAPINFOHEADER bmiHeader;
   RGBQUAD          bmiColors[256];
} BITMAPINFOex;
 
I dont have any code snips, but allocate space for a new "BITMAPINFOex" in memory and use your original loop to populate the values.  Then when passing this to structure to the API call you might then have to cast it to a normal BITMAPINFO structure...
 
I know what to do but not the details of how best to get it done (like yourself).  You might have better like posting a link to this thread in one of the C related boards Robot Very Happy
0 Kudos
Message 13 of 14
(1,097 Views)
Yep that runs great.  I think when I tried to cast (BITMAPINFO*) before is was still casting it as the redefined version.  Again, thank you for the help Chaos I couldn't have done it without you.
0 Kudos
Message 14 of 14
(1,094 Views)