DVP_IdentifyFile(
HWND:hWnd,
LPTSTR:lpszName,
LPVIEWERPLUGINFILEINFO:lpVPFileInfo,
HANDLE:hAbortEvent
)
→ BOOL
The DVP_IdentifyFile function is called to determine whether the plugin can identify and view a disk file.
This function is called to identify a disk-based file. This function is always called, unless:
Ordinarily, when this function is called your plugin should examine the file specified by lpszName to determine whether it can be viewed or not. If your plugin can support this file, you should fill in as much of the VIEWERPLUGINFILEINFO as possible and return TRUE to indicate that you can view this file. If the plugin returns FALSE, Directory Opus will then continue the identification process with the next plugin.
Note that even if you specified one of the DVPFIF_ExtensionsOnly flags, your DVP_IdentifyFile function will still be called, but only for files that match the file name extensions you specified. In this instance, you may wish to skip the actual file identification step and simply fill out as much of the VIEWERPLUGINFILEINFO as you can and return.
Also note that the VIEWERPLUGINFILEINFO structure is used by both the VFS_IdentifyFile function and the VFS_LoadBitmap functions. Many of the flags in the structure are only applicable in VFS_LoadBitmap (for example, DVPFIF_NoThumbnailBorder.) Generally, VFS_IdentifyFile does not need to set anything other than the DVPFIF_CanXXXXXX flags (can return bitmap, can return viewer, etc.) - although setting the other flags here will not hurt, you do not need to set the others until VFS_LoadBitmap is called.
The VIEWERPLUGINFILEINFO structure contains the following fields:
The hAbortEvent parameter to the DVP_IdentifyFile is used by Directory Opus to allow the user to abort a potentially lengthy file identification process. The same technique is also used in the DVP_LoadBitmap and other functions. If you wish to allow the user to abort your plugin (which is highly recommended), you should make sure that you check the event for signaled status at regular intervals. For example,
if ( hAbortEvent && WaitForSingleObject( hAbortEvent, 0 ) == WAIT_OBJECT_0 ) { // aborted }