Opening an AVI File
The following example initializes the AVIFile library using the AVIFileInit function and opens an AVI file using the AVIFileOpen function. The function uses a default file handler.
// LoadAVIFile - loads AVIFile and opens an AVI file.
//
// szfile - filename
// hwnd - window handle
//
VOID LoadAVIFile(LPCSTR szFile, HWND hwnd)
{
LONG hr;
PAVIFILE pfile;
AVIFileInit(); // opens AVIFile library
hr = AVIFileOpen(&pfile, szFile, OF_SHARE_DENY_WRITE, 0L);
if (hr != 0){
// Handle failure.
return;
}
//
// Place functions here that interact with the open file.
//
AVIFileRelease(pfile); // closes the file
AVIFileExit(); // releases AVIFile library
}