09-17-2012 03:00 PM
Daniel, I tried creating my own black and white striped image, and I did get the incorrect behavior Nate was experiencing. In addition, I was able to recreate the behavior with a 12-bit camera.
Eric, thanks for confirming this is a bug. I move on to trying out the built-in display through VisualStudio and GDI+.
Nate, I was looking at the Format16bppGrayScale option when trying to build this workaround and I got the same error. Most of what I could find suggests the member isn't supported by Microsoft and was implemented incompletely for display.
09-20-2012 05:32 PM
Hi Nate,
I have a small snippet of code that should allow you to work around the issue for the time being. Note that this is C code so you might have to either compile it into a native DLL or re-work it using native C#/PInvoke calls. Presumably if you were already calling the IMAQ C functions from C# then you'll be able to figure how to emulate what this C code is doing
Int32 imgPlotDC2_workaround(void* hdc, void* buffer, uInt32 leftOffset, uInt32 topOffset, uInt32 xsize, uInt32 ysize, uInt32 xpos, uInt32 ypos, uInt32 flags) { static HMODULE library = NULL; typedef int (__stdcall *Gen_PlotImageToDCFunc)(void*, const void*, uInt32, uInt32, uInt32, uInt32, uInt32, uInt32, uInt32); static Gen_PlotImageToDCFunc func = NULL; if(!library) library = LoadLibrary("nivissvc.dll"); if(!func) func = (Gen_PlotImageToDCFunc)(GetProcAddress(library, "Gen_PlotImageToDC")); return (*func)(hdc, buffer, leftOffset, topOffset, xsize, ysize, xpos, ypos, flags); }
Note that this code is untested and may cease to work in the future as it is using internal interfaces.
Eric
09-25-2012 12:22 PM
Hi Eric,
Sorry for the long delay in my response. Yes, the Gen_PlotImageToDC function is working in my 64-bit application. This is an acceptable solution for now. Please keep us informed when imgPlotDC2 is fixed.
Thanks,
Nate