From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use "imgPlot" to draw on a control of VC++??

Detail of yesterday question----
I want to show a image on a static picture control on dialog by vc++, the function I used was a NI-IMAQ "imgPlot" to draw image on the control, beacuse it is easier and faster with capture card.

imgPlot ((GUIHNDL)hFrameWnd, pImg, 0, 0, src->width, src->height,0, 0, IMGPLOT_MONO_8);

I get the control's HWND by GetSafeHWnd() to set the first paprameter and set the second parameter with a buffer pointer, since I just want to test, so buffer data is not obtained by capture card, but from a file. No image display on the control, no errors display either, why?
0 Kudos
Message 1 of 5
(3,011 Views)
Hello,

Do you have any image data in your buffer that you are trying to display? Are you doing error checking?
Try running the following built-in example and make sure you get that to work: C:\Program Files\National Instruments\NI-IMAQ\Sample\MSVC\Snap\HL Snap
Try customizing this image so that it'll point to your image in the buffer versus live acquisition.
Let me know if you have further questions regarding this.

Regards,

Yusuf C.
Applications Engineering
National Instruments
Message 2 of 5
(3,011 Views)
src= iplCreateImageHeader( 1, 0, IPL_DEPTH_8U, "GRAY",
"GRAY", IPL_DATA_ORDER_PIXEL, IPL_ORIGIN_TL,
IPL_ALIGN_DWORD, width, height, NULL, NULL, NULL,
NULL);
iplAllocateImage( src, 0, 0 );
......
static HWND hImgWnd;
CWnd* pImgWnd = NULL;
pImgWnd = GetDlgItem(IDC_STATIC_IMG);
hImgWnd = pImgWnd->GetSafeHwnd();
char *pImg = src->imageData;
imgPlot ((GUIHNDL)hImgWnd, pImg, 0, 0, src->width, src->height,0, 0, IMGPLOT_MONO_8);

That sample program works well, but it is a windows program, not a MFC VC++ program. In my program I use MFC as above, but it can not work. I debug my program, I think datas are in the buffer. I think even there are no datas in buffer, there should be some displays on the static control, but nothing displayed, just every contro
l on the dialog including button,etc, is lost for a while then re-appear again.

Looking forward to your reply!!!!
0 Kudos
Message 3 of 5
(3,011 Views)
I don't think there should be any difference as long as you're doing a direct function call to the driver.
Did you enable error checking in your application? Was there an error? If so, what is the error code and the error string?

Regards,

Yusuf C.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 5
(3,011 Views)
I didn't use error check. It is strange, when I use capture card, and display image from the buffer, it will works, but from file, it cann't work.
0 Kudos
Message 5 of 5
(3,011 Views)