Frame Grabber SDK (Windows-C) Developer Guide
if (NULL != hDevice)
{
nRet = MV_FG_CloseDevice(hDevice);
if (MV_FG_SUCCESS != nRet)
{
printf("Close device failed! %#x\n", nRet);
}
hDevice = NULL;
}
// Close the frame grabber.
if (NULL != hInterface)
{
nRet = MV_FG_CloseInterface(hInterface);
if (MV_FG_SUCCESS != nRet)
{
printf("Close interface failed! %#x\n", nRet);
}
hInterface = NULL;
}
printf("Press any key to exit.\n");
WaitForKeyPress();
return 0;
}
A.3 Acquire Images with User Registering Buffers
The following sample codes show how to acquire images using buffers registered to stream channels
by the user.
#include <stdio.h>
#include <Windows.h>
#include <process.h>
#include <conio.h>
#include "MVFGControl.h"
#define BUFFER_NUMBER
#define FILE_NAME_LEN
#define SAVE_IMAGE_NUM
#define TIMEOUT
3
256
10
1000
// Number of requested buffers
// The maximum length of file name
// The maximum number of saved images
// Timeout; unit: millisecond (ms)
bool g_bExit = false;
// Stop acquisition
// Wait for key press.
void WaitForKeyPress(void)
{
while(!_kbhit())
{
Sleep(10);
85
    "