
Frame Grabber SDK (Windows-C) Developer Guide
{
printf("Open stream failed! %#x\n", nRet);
break;
}
// Register the exception information callback function of the stream channel.
//nRet = MV_FG_RegisterExceptionCallBack(hStream, ExceptionCb, hStream);
//if (MV_FG_SUCCESS != nRet)
//{
// printf("Register stream exception callback failed!\n");
// break;
//}
// Set the number of internal buffers for the SDK.
nRet = MV_FG_SetBufferNum(hStream, BUFFER_NUMBER);
if (MV_FG_SUCCESS != nRet)
{
printf("Set buffer number failed! %#x\n", nRet);
break;
}
// Create thread for image acquisition.
void* hThreadHandle = (void*)_beginthreadex(NULL, 0, GrabbingThread, hStream, 0, NULL);
if (NULL == hThreadHandle)
{
printf("Create thread failed!\n");
break;
}
printf("Press any key to stop acquisition.\n");
WaitForKeyPress();
// Stop image acquisition thread.
g_bExit = true;
WaitForSingleObject(hThreadHandle, INFINITE);
CloseHandle(hThreadHandle);
hThreadHandle = NULL;
} while (0);
// Close stream channel.
if (NULL != hStream)
{
nRet = MV_FG_CloseStream(hStream);
if (MV_FG_SUCCESS != nRet)
{
printf("Close stream failed! %#x\n", nRet);
}
hStream = NULL;
}
// Close the device.
84





















































































































































