OpenPlugin

The OpenPlugin is called to create a new plugin instance.
HANDLE WINAPI OpenPlugin(
  int OpenFrom,
  INT_PTR Item
);

Parameters

OpenFrom
Identifies how the plugin is invoked. Can be one of the following values (OPENPLUGIN_OPENFROM enum):
ConstantDescription
OPEN_DISKMENU Opened from the disks menu
OPEN_PLUGINSMENU Opened from the plugins menu (F11)
OPEN_FINDLIST Opened from the "Find File" dialog. The plugin will be called with this identifier only if it exports the SetFindList function, and SetFindList will be called only if OpenPlugin returns a valid handle.
OPEN_SHORTCUT Opened using a folder shortcut command.
OPEN_COMMANDLINE Opened from the command line.. This type is used if the plugin has defined a command prefix in the GetPluginInfo function, and this prefix, followed by a colon, is found in the command line.
OPEN_EDITOR Opened from internal editor
OPEN_VIEWER Opened from internal viewer.
OPEN_DIALOG Opened from dialog
Item
Its meaning depends on the value of OpenFrom:

Return value

If the function succeeds, the return value is a plugin handle. This handle will be passed later to other plugin functions to allow them to distinguish different plugin instances. Handle format is not important for FAR, it can be the address of a new plugin class object, or the address of a structure with plugin data, or an array index, or any other value but zero.

If the function fails, the return value must be INVALID_HANDLE_VALUE.

Remarks

  1. Note that you can use this function to implement FAR commands that work without creating new panels. Just perform all necessary actions here and return INVALID_HANDLE_VALUE.
  2. If this functions returns zero, the plugin will be unloaded.