PluginStartupInfo

Far Manager

PluginStartupInfo

The PluginStartupInfo structure is used in the SetStartupInfo function to pass various important information to the plugin.
struct PluginStartupInfo
{
  int StructSize;

  char ModuleName[NM];
  int ModuleNumber;
  const char *RootKey;
  FARAPIMENU             Menu;
  FARAPIDIALOG           Dialog;
  FARAPIMESSAGE          Message;
  FARAPIGETMSG           GetMsg;
  FARAPICONTROL          Control;
  FARAPISAVESCREEN       SaveScreen;
  FARAPIRESTORESCREEN    RestoreScreen;
  FARAPIGETDIRLIST       GetDirList;
  FARAPIGETPLUGINDIRLIST GetPluginDirList;
  FARAPIFREEDIRLIST      FreeDirList;

  // FAR >= 1.50
  FARAPIVIEWER           Viewer;
  FARAPIEDITOR           Editor;
  FARAPICMPNAME          CmpName;

  // FAR >= 1.52
  FARAPICHARTABLE        CharTable;
  FARAPITEXT             Text;

  // FAR >= 1.60
  FARAPIEDITORCONTROL    EditorControl;

  // FAR >= 1.70
  FARSTANDARDFUNCTIONS  *FSF;

  FARAPISHOWHELP         ShowHelp;
  FARAPIADVCONTROL       AdvControl;
  FARAPIINPUTBOX         InputBox;
  FARAPIDIALOGEX         DialogEx;
  FARAPISENDDLGMESSAGE   SendDlgMessage;
  FARAPIDEFDLGPROC       DefDlgProc;
  DWORD_PTR              Reserved;
  FARAPIVIEWERCONTROL    ViewerControl;
};

Elements

StructSize
Structure size. If new fields are added, this field will allow detection of the version of the structure used.
ModuleName
Full name with path of the plugin module.
ModuleNumber
Number of the plugin module. Passed as parameter in some functions.
RootKey
Registry root key, where plugins can save their parameters. Valid both for HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE. Usually it is "Software\Far\Plugins", but you must not specify this string directly, because it can be changed or can become optional in future. For example, if FAR is started with '/u user1' command line parameter, RootKey will contain "Software\Far\Users\user1\Plugins".

Do not save parameters directly in the RootKey, create your own subkey here.

Menu
Address of the Menu function.
Dialog
Address of the Dialog function.
Message
Address of the Message function.
GetMsg
Address of the GetMsg function.
Control
Address of the Control function.
SaveScreen
Address of the SaveScreen function.
RestoreScreen
Address of the RestoreScreen function.
GetDirList
Address of the GetDirList function.
GetPluginDirList
Address of the GetPluginDirList function.
FreeDirList
Address of the FreeDirList function.
Viewer
Address of the Viewer function.
Editor
Address of the Editor function.
CmpName
Address of the CmpName function.
CharTable
Address of the CharTable function.
Text
Address of the Text function.
EditorControl
Address of the EditorControl function.
FSF
Pointer to the FarStandardFunctions structure, which contains addresses of useful functions from far.exe.
ShowHelp
Address of the ShowHelp.
AdvControl
Address of the AdvControl.
InputBox
Address of the InputBox.
DialogEx
Address of the DialogEx.
SendDlgMessage
Address of the SendDlgMessage.
DefDlgProc
Address of the DefDlgProc.
DefDlgProc
Address of the ViewerControl.

Remarks

FAR Manager versions:
  • below 1.50 (with plugins support) - do not contain fields after FreeDirList;
  • below 1.52 - do not contain fields after CmpName;
  • below 1.60 - do not contain fields after Text;
  • below 1.65 - do not contain fields after EditorControl
So, if you intend to use Viewer or Editor functions or any other function after these, you should first check the StructSize field, to determine if the required function is present in the running FAR version.
See also: