reference:plugins:viewer_plugins:plugin_identification:dvp_identify

DVP_Identify(
     LPVIEWERPLUGININFO:lpVPInfo
)
→ BOOL

Arguments

lpVPInfo

Pointer to a VIEWERPLUGININFO structure that you must fill out (described below).

Return value

A return code of TRUE indicates that the viewer plugin is ready to view files; a return of FALSE means that Directory Opus will not call the plugin again in this session.

Description

The DVP_Identify function identifies the plugin to Directory Opus.

Directory Opus passes you the address of a VIEWERPLUGININFO structure, and you must fill out the applicable members of this structure before returning. A return code of TRUE indicates that the viewer plugin is ready to view files; a return of FALSE means that Directory Opus will not call the plugin again in this session.

The members of the VIEWERPLUGININFO structure are as follows:

  • [in] UINT cbSize
    Directory Opus initializes this field to the size of the structure before passing it to your function. You must only fill in fields in the structure up to the size supplied by Directory Opus. This allows your plugin to be compatible with future versions of Directory Opus that may support more fields in this structure.
  • [out] DWORD dwFlags
    The flags field is used to indicate the capabilities of the plugin. The currently defined flags are:
    • DVPFIF_CanHandleStreams
      Indicates that the plugin can accept an IStream interface to identify and view files from a data stream as well as from a disk file. Specifying this flag implies that the plugin exports the DVP_IdentifyFileStream function. For a bitmap method plugin, it also implies that the DVP_LoadBitmapStream function is exported. For a window method plugin, it implies that your viewer window can handle the DVPLUGINMSG_LOADSTREAM message.
    • DVPFIF_CanHandleBytes
      Indicates that the plugin can identify a file based on the header of the file. Specifying this flag implies that the plugin exports the DVP_IdentifyFileBytes function. If this function is provided, Directory Opus will call it with a chunk of data from the start of the file (currently 256 bytes). If you can reliably identify your files in this manner this is the recommended method, as the data only needs to be read from the file once and can be passed to every plugin very quickly.
    • DVPFIF_CatchAll
      Indicates that the plugin wants to be one of the last plugins called to identify a given file. This provides a simple priority mechanism for the plugin system. For example, a viewer plugin that handles multiple image formats may want to be called last in order to allow other plugins that handle specific formats to override it.
    • DVPFIF_DefaultCatchAll
      This is similar to the DVPFIF_CatchAll flag except that a plugin with this flag specified will be called as the very last plugin, instead of just "one of the last". For that reason, only one plugin can have this flag set, and the first plugin with it set that Directory Opus finds will be the one that is called last. This should only be used by a plugin that can handle any type of file; for example, the text.dll text/hex viewer plugin that is supplied with Directory Opus has this flag set. You would ordinarily only set this flag if you wanted to replace the supplied text/hex viewer with one of your own.
    • DVPFIF_ExtensionsOnly
      This flag indicates that the plugin does not care about the actual contents of a file; it will identify a file based only upon the file name extension. If this flag is set, Directory Opus will compare the file name extension of a given file with the extensions you have specified in the lpszHandleExts field, and if the extension does not match one your supported extensions, your plugin identification functions will not be called for that file. This can dramatically speed up the file identification process but at the cost of support for files without the standard or expected file name extensions (although in the Windows world this is not necessarily a big problem).
    • DVPFIF_ExtensionsOnlyIfSlow
      This flag is similar to the DVPFIF_ExtensionsOnly flag, except that it only takes effect if the file to be identified is "slow". In the current version, the only files that meet this definition are those accessed via FTP, however this may change in the future. You should set this flag if your binary file comparison procedure requires the reading of significant amounts of data.
    • DVPFIF_ExtensionsOnlyIfNoRndSeek
      Similar to the DVPFIF_ExtensionsOnly flag except that it only takes effect if the file to be identified does not support "random seeking" (that is, it only supports sequential access moving forward from the start of the file). Currently this only applies to files on FTP sites and those within ZIP files.
    • DVPFIF_ExtensionsOnlyForThumbnails
      Similar again to the DVPFIF_ExtensionsOnly flag except that it only takes effect if the file identification is being performed for the Thumbnails Lister mode. For example, you may wish to only identify files based on file name extension when viewing Thumbnails to increase the speed of display, but still allow the user to view files in the Viewer Pane or image viewer that don't have a recognized file name extension.
    • DVPFIF_NoSlowFiles
      Set this flag if your plugin does not support identifying or viewing "slow" files. Currently this only applies to files accessed via FTP. If this flag is set, your plugin will never be called for slow files.
    • DVPFIF_NeedRandomSeek
      Set this flag if your plugin is dependant upon being able to randomly seek within a file in order to identify or view it. Files within ZIP files and those accessed via FTP do not support random seeking. If this flag is set, your plugin will never be called for those files.
    • DVPFIF_CanConfigure
      This flag indicates that your plugin exports the DVP_Configure function. Directory Opus will enable the Configure option in the plugin context menu and in the standard Viewer Plugins menu for your plugin, and call this function to allow the user to configure your plugin.
    • DVPFIF_CanShowAbout
      This flag indicates that your plugin exports the DVP_About function to display a custom About dialog. If not specified, Directory Opus will display a standard About dialog for your plugin using the information you provide in the fields described below.
    • DVPFIF_NoThumbnails
      If your plugin supports the bitmap method by exporting the DVP_LoadBitmap function, it will ordinarily be called to generate Thumbnails for display in a Lister. If you set this flag, however, Directory Opus will not call your plugin to generate Thumbnails. You may wish to set this if your plugin takes a significant amount of time to generate an image.
    • DVPFIF_NoProperties
      Setting this flag will prevent Directory Opus from displaying the Properties item on the standard context menu in the Viewer Pane for your plugin.
    • DVPFIF_ZeroBytesOk
      Set this flag if your plugin can display zero byte files. You will ordinarily not want to set this, in which case Directory Opus will not call your plugin for zero byte files. The text.dll plugin sets this flag so that when the user selects a zero byte file to view the file is still displayed (even though it is empty).
    • DVPFIF_OverrideInternal
      Set this flag if you want your plugin to override the internal Opus image routines for supported image file formats. Opus natively supports several image formats including BMP, GIF, JPG, PNG, PSP, etc. If you set this flag then your plugin will be offered the chance to identify and view a file of this format before the internal Opus routines are invoked.
    • DVPFIF_InitialDisable
      The plugin is to be initially disabled. The first time Opus encounters this plugin it will mark it as disabled - it can then be enabled manually by the user if desired.
    • DVPFIF_NoFileInformation
      The plugin is not to be called to retrieve file information (eg, for the Description field.)
    • DVPFIF_ProvideFileInfo
      The plugin can provide file information but is not able to actually display the files.
    • DVPFIF_NoMultithreadThumbnails
      Opus is able to generate thumbnails on multiple threads simultaneously - if this flag is set then your plugin will not be called simultaneously from multiple threads.
    • DVPFIF_FolderThumbnails
      The plugin is able to provide thumbnails for folders.
    • DVPFIF_TrueThumbnailSize
      The true thumbnail size will always be provided when generating thumbnails.
    • DVPFIF_UseVersionResource
      Set this flag if you want Opus to use your plugin's version resource for file version and copyright information, rather than the fields in the VIEWERPLUGININFO structure.
    • DVPFIF_CanShowHex
      Set this flag if your plugin is able to display a hexadecimal (raw) view of files.
    • DVPFIF_OnlyThumbnails
      Set this flag if your plugin is only to be called to generate thumbnails and not for viewing files.
  • [out] DWORD dwVersionHigh, dwVersionLow
    These fields can be used to indicate to Directory Opus the version number of your plugin. Opus does not use these values directly; however they are displayed to the user in the standard About dialog for your plugin.
  • [out] LPTSTR lpszHandleExts
    This field allows you to indicate to Directory Opus the file name extensions that your plugin supports. If you wish to support all types of file, or only identify files based on their content, you may leave this blank or set to * to indicate all files, although it is recommended that you still specify one or more extensions so as to indicate to the user the files that your plugin is designed to handle. The value of this field is displayed to the user in the standard About dialog for your plugin.

    When Directory Opus calls your plugin, this field may point to a buffer into which you can copy your information. The size of this buffer is given by the cchHandleExtsMax field. You can either use this supplied buffer or change the address of the lpszHandleExts field to point to your own buffer. You must check before copying into this field that the buffer pointer is valid; if set to 0 it indicates that Directory Opus does not want this information at this time.

    To specify more than one file extension, separate them with semicolons. For example, .jpg;.gif;.png
  • [out] LPTSTR lpszName
    This field lets you specify the "name" of your plugin. Ordinarily this will be the primary file format that your plugin supports, eg TARGA. However, this can be any string. The name is displayed to the user in the standard Viewer Plugins menu as well as the standard About dialog for your plugin. It is also used as the parameter for certain Opus internal commands that take a plugin name on the command line.

    When Directory Opus calls your plugin, this field may point to a buffer into which you can copy your information. The size of this buffer is given by the cchNameMax field. You can either use this supplied buffer or change the address of the lpszName field to point to your own buffer. You must check before copying into this field that the buffer pointer is valid; if set to 0 it indicates that Directory Opus does not want this information at this time.
  • [out] LPTSTR lpszDescription
    Lets you specify a description for your plugin that is displayed to the user in the standard About dialog for your plugin. Can be any text string but should not ordinarily be more than about 50 characters in length.

    When Directory Opus calls your plugin, this field may point to a buffer into which you can copy your information. The size of this buffer is given by the cchDescriptionMax field. You can either use this supplied buffer or change the address of the lpszDescription field to point to your own buffer. You must check before copying into this field that the buffer pointer is valid; if set to 0 it indicates that Directory Opus does not want this information at this time.
  • [out] LPTSTR lpszCopyright
    Use this field to supply a copyright notice that is displayed to the user in the standard About dialog for your plugin.

    When Directory Opus calls your plugin, this field may point to a buffer into which you can copy your information. The size of this buffer is given by the cchCopyrightMax field. You can either use this supplied buffer or change the address of the lpszCopyright field to point to your own buffer. You must check before copying into this field that the buffer pointer is valid; if set to 0 it indicates that Directory Opus does not want this information at this time.
  • [out] LPTSTR lpszURL
    Use this field to supply a URL string that is displayed to the user in the standard About dialog for your plugin. This can be any URL, for example, the URL for the homepage on your website for your plugin.

    When Directory Opus calls your plugin, this field may point to a buffer into which you can copy your information. The size of this buffer is given by the cchURLMax field. You can either use this supplied buffer or change the address of the lpszURL field to point to your own buffer. You must check before copying into this field that the buffer pointer is valid; if set to 0 it indicates that Directory Opus does not want this information at this time.
  • [in] UINT cchHandleExtsMax, cchNameMax, cchDescriptionMax, cchCopyrightMax, cchURLMax
    These fields specify the supplied buffer size for the relevant string fields in the structure. You must make sure you do not copy more data into the supplied buffers than is specified in these fields. The size specified is given in characters, not bytes.
  • [out] DWORDLONG dwlMinFileSize, dwlMaxFileSize
    You can use these fields to specify the minimum and maximum size files that your plugin will handle in the image viewer. The dwlMinFileSize field is particularly useful for speeding up file identification, as it is often possible to determine that a file is not a particular format simply because it is too small. If the file in question is smaller or larger than the bounds set by these fields then it will not be submitted to your plugin for identification or viewing. Set these fields to 0 to disable the size check.
  • [out] DWORDLONG dwlMinPreviewFileSize, dwlMaxPreviewFileSize
    Similar to the dwlMinFileSize and dwlMaxFileSize fields except that they only apply when a file is being "previewed", that is, displayed in the Viewer Pane in a Lister.
  • [out] UINT uiMajorFileType
    Use this field to indicate to Directory Opus the "major type" of file that your plugin handles. The major file types are defined in the viewer plugin header file; currently defined are DVPMajorType_Image, DVPMajorType_Sound and DVPMajorType_Text. In some instances this can speed up identification, for example Directory Opus will only call plugins marked as DVPMajorType_Image for thumbnails, Lister background pictures, etc.
  • [out] GUID idPlugin
    You must assign a GUID to your plugin to allow Directory Opus to internally uniquely identify it.
  • [in] DWORD dwOpusVerMajor, dwOpusVerMinor
    The current version number of Directory Opus.
  • [in] DWORD dwInitFlags
    Initialization flags. Currently defined flags are:
    • VPINITF_FIRSTTIME
      If this flag is set it indicates this is the first time your plugin is being initialized.
    • VPINITF_USB
      If this flag is set it indicates Directory Opus is running from a USB device.
  • [out] HICON hIconSmall, hIconLarge
    You can use these fields to provide icons that are displayed in the plugin list in the Directory Opus Preferences. Note that Opus will free these icons by calling DestroyIcon().