Page 1 of 1

Visual C++ .net

Posted: Wed Jun 30, 2010 7:36 am
by avelazquez
I will like to thank in advance anyone willing to help me; I am trying to get the image displayed in a picturebox using DrawFrame, I am having a hard time figuring out how to get the picture handle. I am using Visual C++ .net, below is a portion of the code I'm using.

waittime = 10; // value in milliseconds; 0 = don't wait; INFINITE = wait till data
running = 6000; // run ~1 minute for waittime=10 ms

while(running--) //!TimeToClose
{
pCamera->GetFrame(waittime, &pFrame);
?//pCamera->DrawFrame(pFrame, pictureBox1);
pFrame->Free();
}

// shut everything down
pCamera->Stop();
pCamera->Close();

CoUninitialize();

Re: Visual C++ .net

Posted: Wed Jun 30, 2010 3:09 pm
by Birch
If you have an ID for the picturebox you can use the following example (which draws over a GroupBox frame).

pCamera->DrawFrame(pFrame, (LONG) GetDlgItem(IDC_STATIC_FRAME_IMAGE)->GetSafeHwnd());

Which assumes :
GROUPBOX "",IDC_STATIC_FRAME_IMAGE,147,3,240,340



Also, if there is an issue with the picture box allowing the SDK to paint the image on top of it, then you could alternately try GetFrameImage (search this forum for more posts about that)