
Frame Grabber SDK (Windows-C) Developer Guide
{
printf("Invalid device index.\nQuit.\n");
break;
}
// Open the device and get the device handle.
nRet = MV_FG_OpenDevice(hInterface, (unsigned int)nDeviceIndex, &hDevice);
if (MV_FG_SUCCESS != nRet)
{
printf("Open No.%d device failed! %#x\n", nDeviceIndex, nRet);
hDevice = NULL;
break;
}
// Disable trigger mode.
nRet = MV_FG_SetEnumValueByString(hDevice, "TriggerMode", "Off");
if (MV_FG_SUCCESS != nRet)
{
printf("Turn off trigger mode failed! %#x\n", nRet);
break;
}
// Get the number of stream channels.
unsigned int nStreamNum = 0;
nRet = MV_FG_GetNumStreams(hDevice, &nStreamNum);
if (MV_FG_SUCCESS != nRet || 0 == nStreamNum)
{
printf("No stream available! return = %d, number = %d\n", nRet, nStreamNum);
break;
}
// O stream channel (currently only one stream channel is supported at a time).
nRet = MV_FG_OpenStream(hDevice, 0, &hStream);
if (MV_FG_SUCCESS != nRet)
{
printf("Open stream failed! %#x\n", nRet);
break;
}
// Get the image size of the stream channel.
unsigned int nPayloadSize = 0;
nRet = MV_FG_GetPayloadSize(hStream, &nPayloadSize);
if (MV_FG_SUCCESS != nRet)
{
printf("Get payload size failed! %#x\n", nRet);
break;
}
// Register buffer to stream channel.
for (unsigned int i = 0; i < BUFFER_NUMBER; i++)
{
92





















































































































































