
Frame Grabber SDK (Windows-C) Developer Guide
nRet = DLLOpenStream(hDevice, 0, &hStream);
if (MV_FG_SUCCESS != nRet)
{
printf("Open stream failed! %#x\n", nRet);
break;
}
// Set the number of internal buffers for the SDK.
DLL_SetBufferNum DLLSetBufferNum = (DLL_SetBufferNum)GetProcAddress(MVFGCtrlDll,
"MV_FG_SetBufferNum");
nRet = DLLSetBufferNum(hStream, BUFFER_NUMBER);
if (MV_FG_SUCCESS != nRet)
{
printf("Set buffer number failed! %#x\n", nRet);
break;
}
// Create thread for image acquisition.
MultiThrParam stThreadParam = { 0 };
stThreadParam.pUser = hStream;
stThreadParam.hDll = MVFGCtrlDll;
void* hThreadHandle = (void*)_beginthreadex(NULL, 0, GrabbingThread,
(void*)&stThreadParam, 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)
{
DLL_CloseStream DLLCloseStream = (DLL_CloseStream)GetProcAddress(MVFGCtrlDll,
"MV_FG_CloseStream");
nRet = DLLCloseStream(hStream);
if (MV_FG_SUCCESS != nRet)
{
printf("Close stream failed! %#x\n", nRet);
}
hStream = NULL;
}
128





















































































































































