Frame Grabber SDK (Windows-C) Developer Guide
{
printf("Allocate Buffer error\n");
nRet = MV_FG_ERR_OUT_OF_MEMORY;
break;
}
// Register the buffer for SDK.
nRet = MV_FG_AnnounceBuffer(hStream, pBuffer[i], nImagePayloadSize, NULL,
&(hBuffer[i]));
if (MV_FG_SUCCESS != nRet)
{
printf("Announce Buffer error, %#x\n", nRet);
break;
}
}
if (MV_FG_SUCCESS != nRet)
{
break;
}
// Insert all buffers back to the input queue.
nRet = MV_FG_FlushQueue(hStream, MV_FG_BUFFER_QUEUE_ALL_TO_INPUT);
if (MV_FG_SUCCESS != nRet)
{
break;
}
// Create a thread for streaming.
void* hThreadHandle = (void*) _beginthreadex(NULL , 0 , GrabbingThread , hStream, 0 , NULL);
if (NULL == hThreadHandle)
{
printf("Create Thread Error\n");
break;
}
printf("Press any key to stop acquisition.\n");
WaitForKeyPress();
g_bExit = true;
WaitForSingleObject(hThreadHandle, INFINITE);
CloseHandle(hThreadHandle);
hThreadHandle = NULL;
} while (0);
// Release relative resources.
if (NULL != hStream)
{
// Clear the buffer queue.
nRet = MV_FG_FlushQueue(hStream, MV_FG_BUFFER_QUEUE_ALL_DISCARD);
if (MV_FG_SUCCESS != nRet)
137
    "