Three functions are provided to support "special" actions on files.
VFS_ContextVerb is called whenever the user attempts to "invoke" a file in your namespace. This may be by double-clicking on it, right-clicking and choosing Open from the context menu, or running the internal FileType command on it. The most common requirement of the VFS_ContextVerb function is to be able to open or launch files from your namespace.
int VFS_ContextVerb( HANDLE hVFSData, LPVFSFUNCDATA lpFuncData,
LPVFSCONTEXTVERBDATA lpVerbData )
hVFSData is your namespace instance handle, and lpFuncData is currently unused. lpVerbData points to a VFSCONTEXTVERBDATA structure which contains information about the file and which action to perform on it. This structure is defined as follows:
There are a number of different return codes defined for VFS_ContextVerb. These are:
VFS_ExtractFiles is a function that Opus calls from time to time to extract one or more files from your plugin's namespace to a local file. For example, if you return VFSCVRES_EXTRACT from the VFS_ContextVerb function, Opus will call this function to extract the file to a local temporary file. If you do not provide this function then Opus will attempt to extract the file itself using VFS_CreateFile and VFS_ReadFile. If you are able to extract files in a more efficient manner than this you should implement this function.
BOOL VFS_ExtractFiles( HANDLE hVFSData, LPVFSFUNCDATA lpFuncData,
LPVFSEXTRACTFILESDATA lpExtractData )
hVFSData is your namespace instance handle, and lpFuncData is currently unused. lpExtractData points to a VFSEXTRACTFILESDATA structure which contains information about the file or files to be extracted. This structure is defined as follows:
When this function is called in your plugin you should attempt to extract the specified file or files to the specified destination folder. If the extraction operation will take a significant time you may wish to consider displaying a progress dialog and giving the user the option of aborting the operation.
If the file extraction was successful you should return TRUE, otherwise you should set an appropriate error code and return FALSE.
The VFS_Properties function (not to be confused with VFS_PropGet) is called when the user wants to view a Properties dialog for one or more files in your namespace. If you specified the VFSCAPABILITY_COMBINEDPROPERTIES capability flag your VFS_Properties function may be called with multiple filenames and you should display an appropriate dialog that combines the properties of these files as best you can. If you did not specify the combined properties capability flag then VFS_Properties will only ever be called with a single filename.
HWND VFS_Properties( HANDLE hVFSData, LPVFSFUNCDATA lpFuncData,
HWND hwndParent, LPTSTR lpszFiles )
hVFSData is your namespace instance handle, and lpFuncData is currently unused. hwndParent is the handle to the parent window - any dialog you display should use this window as a parent and should position itself relative to this window. lpszFiles is a double null-terminated list of strings containing the full pathnames of the files to show Properties for. If you do not support combined properties you can treat this as a simple string.
Your VFS_Properties function can either be modal or modeless. Modal means that you will run a message loop to display the dialog, and destroy the dialog when the user closes it. If you are implementing this as a modal function you should simply return TRUE or FALSE from this function (cast to HWND). A modeless function, on the other hand, returns the handle of a dialog window. Opus then runs a standard dialog message loop, and will destroy the dialog itself when the user clicks the close button or the Ok or Cancel button (that is, in response to a WM_CLOSE or appropriate WM_COMMAND message.)
The dialog you display should be as similar in appearance to the standard Windows file Properties dialog as possible, to avoid confusing the user and to create a more seamless environment for them. If your plugin does not support the displaying of a Properties dialog at all then simply do not implement this function.