Frame Grabber SDK (Windows-C) Developer Guide
if (false == PrintInterfaceInfo(MVFGCtrlDll, nInterfaceNum))
{
break;
}
// Select frame grabber.
int nInterfaceIndex = -1;
printf("Select an interface: ");
scanf_s("%d", &nInterfaceIndex);
ClearStdin();
if (nInterfaceIndex < 0 || nInterfaceIndex >= (int)nInterfaceNum)
{
printf("Invalid interface index.\nQuit.\n");
break;
}
// Open the frame grabber with specified access mode and get the frame grabber handle.
const int nAccessMode = 2;
// 0 - Unknown, 1 - Read Only, 2 - Control, 3 - Exclusive
DLL_OpenInterfaceEx DLLOpenInterfaceEx =
(DLL_OpenInterfaceEx)GetProcAddress(MVFGCtrlDll, "MV_FG_OpenInterfaceEx");
nRet = DLLOpenInterfaceEx((unsigned int)nInterfaceIndex, nAccessMode, &hInterface);
if (MV_FG_SUCCESS != nRet)
{
printf("Open No.%d interface failed! %#x\n", nInterfaceIndex, nRet);
break;
}
// Enumerate cameras of the frame grabber.
DLL_UpdateDeviceList DLLUpdateDeviceList =
(DLL_UpdateDeviceList)GetProcAddress(MVFGCtrlDll, "MV_FG_UpdateDeviceList");
nRet = DLLUpdateDeviceList(hInterface, &bChanged);
if (MV_FG_SUCCESS != nRet)
{
printf("Update device list failed! %#x\n", nRet);
break;
}
// Get the number of devices.
unsigned int nDeviceNum = 0;
DLL_GetNumDevices DLLGetNumDevices =
(DLL_GetNumDevices)GetProcAddress(MVFGCtrlDll, "MV_FG_GetNumDevices");
nRet = DLLGetNumDevices(hInterface, &nDeviceNum);
if (MV_FG_SUCCESS != nRet || 0 == nDeviceNum)
{
printf("No device found! return = %d, number = %d\n", nRet, nDeviceNum);
break;
}
// Display device information.
if (false == PrintDeviceInfo(MVFGCtrlDll, hInterface, nDeviceNum))
126
    "