title | linktitle | weight |
---|---|---|
Plugin Communication |
plugin-communication |
92 |
Plugins need to communicate with Notepad++ to get information from it or to instruct it to do some task. This is done by using messages and notifications.
Message and notifications share a similar interface. Where messages are sent by using Windows SendMessage api, notifications are sent by Notepad++ using WM_NOTIFY
messages.
These same techniques can also be used for editing macros (some of which use messages to control Notepad++), or when using one of the scripting plugins (which effectively make your script a mini-plugin).
Basically, a message may have a return value, and is usually thought as a query, though it can also command actions inside Notepad++. A notification, on the other hand, simply informs of some event and is more usually thought as a command. The extra content of the messages and notifications are different from each other, and are described in their respective sections below.
To send a message to Notepad++ you send its window handle together with the message ID, and two parameters, known as wParam and lParam. The values placed in those two parameters depend on the message, and are explained below. In cases when either wParam, lParam or both are not used, they must be set to 0.
The message IDs for each of these named messages, as well as the enums used with these messages, can be found in the source code in Notepad_plus_msgs.h.
You can also communicate to the Scintilla editor instances inside Notepad++ by using the Scintilla messages, which are documented at the Scintilla website, and the values can be found in Scintilla.h. Note, you need to use one of the two Scintilla handles as the first parameter to SendMessage api function.
The general layout of the following messages look like this
MESSAGE NAME Description
Parameters: wParam [in/out] lParam [in/out]
Return value
MESSAGE NAME gets replaced by a concrete Notepad++ message like NPPM_ACTIVATEDOC.
Description informs about the usage of the message and provides additional information if needed.
wParam and lParam are the parameters to be provided
in/out indicates whether this is an input or output parameter, meaning in case of output Notepad++ will copy some information into the provided buffer
Return value is the value returned by the SendMessage api call.
Switches to the document by the given view and index.
Parameters:
wParam [in] : int iView, which must bei eihter 0 (main view) or 1 (second view).
lParam [in] : int index2Activate
Return value: : Returns True
Adds an icon to the toolbar. This function makes only sense if called on response to NPPN_TBMODIFICATION notification. cmdID must be a command function id which the plugin registered via getFuncsArray previously. icon is a pointer to the toolbarIcons structure.
Parameters:
wParam [in] : INT cmdID
lParam [in] : toolbarIcons* icon
Return value: : Returns True
Obtains a number of consecutive menu item IDs for creating menus dynamically, with the guarantee of these IDs not clashing with any other plugins.
Parameters:
wParam [in] : int, requested number of IDs.
lParam [out] : int, pointer to allocated range.
Return value: : Returns 0 on failure, nonzero on success
Obtains a number of consecutive marker IDs dynamically, with the guarantee of these IDs not clashing with any other plugins.
Parameters:
wParam [in] : int numberOfMarkers
lParam [out] : int * firstMarkerID
Return value: : Returns 0 on failure, nonzero on success.
**
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns True always
A plugin can create a Scintilla for its usage by sending this message to Notepad++. The handle should be destroyed by NPPM_DESTROYSCINTILLAHANDLE message while exit the plugin.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : HWND pluginWindowHandle, If set (non NULL), it will be the parent window of this created Scintilla handle, otherwise the parent window is Notepad++.
Return value: : Returns the created Scintilla handle.
Changes current buffer view to ansi. view must be either 0 = main view or 1 = second view.
Parameters:
wParam [in] : INT view
lParam [in] : int, must be zero.
Return value: : Returns The new encoding mode.
If plugin called NPPM_CREATESCINTILLAHANDLE to create a Scintilla handle, it should call this message to destroy this handle while it exit.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : HWND scintillaHandle2Destroy
Return value: : Returns True
Disables the auto update functionality of Notepad++.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns True
Retrieves the dialog handle corresponds to the windowName and moduleName. You may need this message if you want to communicate with another plugin "dockable" dialog.
Parameters:
wParam [in] : const TCHAR * windowName
lParam [in] : const TCHAR * moduleName
Return value: : Returns NULL if moduleName is NULL. If windowName is NULL, then the first found window handle which matches with the moduleName will be returned
Hides the dialog which was previously regeistered by NPPM_DMMREGASDCKDLG.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : HWND hDlg, is the handle of your dialog which should be hidden.
Return value: : Returns True
From v4.0, Notepad++ supports the dockable dialog feature for the plugins. Pass the necessary dockingData to Notepad++ in order to make your dialog dockable. Minimum informations which needs to be filled out are hClient, pszName, dlgID, uMask and pszModuleName. Notice that rcFloat and iPrevCont shouldn't be filled. They are used internally
Parameters:
wParam [in] : int, must be zero.
lParam [in] : tTbData * dockingData
typedef struct {
HWND hClient; // client Window Handle
const TCHAR *pszName; // name of plugin (shown in window)
int dlgID; // a funcItem provides the function pointer to start a dialog. Please parse here these ID
// user modifications
UINT uMask; // mask params: look to above defines
HICON hIconTab; // icon for tabs
const TCHAR *pszAddInfo; // for plugin to display additional informations
// internal data, do not use !!!
RECT rcFloat; // floating position
int iPrevCont; // stores the privious container (toggling between float and dock)
const TCHAR* pszModuleName; // it's the plugin file name. It's used to identify the plugin
} tTbData;
Return value: : Returns True
Shows the dialog which was previously regeistered by NPPM_DMMREGASDCKDLG.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : HWND hDlg, is the handle of your dialog which should be shown.
Return value: : Returns True
Updates (redraw) the dialog.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : HWND hDlg, is the handle of the dialog which should be updated.
Return value: : Returns True
Shows the plugin dialog with the given name. name should be the same value as previously used to register the dialog.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : TCHAR* name
Return value: : Returns True
Sets the extension column in doc switcher window. If disableOrNot is True, extension column is hidden otherwise it is visible.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : BOOL disableOrNot
Return value: : Returns True
Switches or openes a file with given fullPathName2Open.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : TCHAR * fullPathName2Open
Return value: : Returns The return value is True (1) if the operation is successful, otherwise False (0).
Changes current buffer view to utf8. view must be either 0 = main view or 1 = second view.
Parameters:
wParam [in] : INT view
lParam [in] : int, must be zero.
Return value: : Returns The new encoding mode.
Retrieves the information whether plugins are loadable from %APPDATA%.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns True if loading plugins from %APPDATA% is allowed, False otherwise
Retrieves the encoding from the document with the given bufferID.
Parameters:
wParam [in] : int bufferID
lParam [in] : int, must be zero.
Return value: : Returns -1 on error, otherwise the encoding number. (see enum UniMode)
Gets the current format of the document with given bufferID.
Parameters:
wParam [in] : int bufferID
lParam [in] : int, must be zero.
Return value: : Returns -1 on error, otherwise documents format (see formatType).
Gets the document buffer ID from the given position.
Parameters:
wParam [in] : int position, is 0 based
lParam [in] : int view, which should be either 0 (main view) or 1 (second view)
Return value: : Returns 0 if given position is invalid, otherwise the document buffer ID.
Retrieves the language type of the document with the given bufferID.
Parameters:
wParam [in] : int bufferID
lParam [in] : int, must be zero.
Return value: : Returns -1 on error, otherwise a value from enum LangType. Please see the enum LangType for all possible values.
Returns the buffer ID of the active document.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns the buffer ID of the active document.
Retrieves the column of the caret.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns the current, 0-based, column position of the caret.
Retrieves the directory path of current document. User is responsible to allocate a buffer which is large enough. MAX_PATH is suggested to use.
Parameters:
wParam [in] : size_t directoryPathLen
lParam [out] : TCHAR * directoryPath
Return value: : Returns True on success and False if provided directoryPath buffer is not large enough
Retrieves the current index of the current view.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int iView, which must bei eihter 0 (main view) or 1 (second view).
Return value: : Returns -1 if the view is invisible (hidden), otherwise is the current index.
Retrieves the language type of the current document.
Parameters:
wParam [ in ] : int, must be zero.
lParam [ out ] : int * langType, pointer to the buffer receiving the language type of the current document Please see the enum LangType for all possible values.
Return value : Returns always True
Retrieves the line of the caret.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns the current, 0-based, line position of the caret.
Retrieves the code page associated with the current localisation of Notepad++.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns As of v6.6.6, returned values are 1252 (ISO 8859-1), 437 (OEM US) or 950 (Big5).
Retrieves the current Scintilla view
Parameters:
wParam [in] : int, must be zero.
lParam [out] : int * currentEdit, pointer to the buffer receiving the current view. The returned value can be one of the following:
Value Meaning
0 The main view
1 The second view
-1 In case of an error
Return value: : Returns always True
*Retrieves the current used view. *
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns Either 0 when main view is active or 1 if secondary view is active.
Retrieves the word containing the caret. User is responsible to allocate a buffer which is large enough.
Parameters:
wParam [in] : size_t currentWordLen
lParam [out] : TCHAR * currentWord
Return value: : Returns True on success and False if provided currentWord buffer is not large enough
Retrieves the current editor default background color.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns The color as integer with hex format being 0x00bbggrr
Retrieves the current editor default foreground.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns The color as integer with hex format being 0x00bbggrr
Returns if visual style of the background of a dialog window is enabled or not.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns A proc address or NULL
Retrieves the extension of the filename of the current document. User is responsible to allocate a buffer which is large enough. MAX_PATH is suggested to use.
Parameters:
wParam [in] : size_t extensionLen
lParam [out] : TCHAR * extension
Return value: : Returns True on success and False if provided extension buffer is not large enough
Retrieves the file name of current document. User is responsible to allocate a buffer which is large enough. MAX_PATH is suggested to use.
Parameters:
wParam [in] : size_t fileNameLen
lParam [out] : TCHAR * fileName
Return value: : Returns True on success and False if provided fileName buffer is not large enough
Retrieves the filename at the current caret position. Note, while this message has been created, and is used internally, to retrieve a filename at the current caret position, it does return anything which fulfils the requirements, even single words.
Parameters:
wParam [in] : INT length
lParam [out] : TCHAR* buffer
Return value: : Returns True if the size of the provided buffer is large enough, False otherwise.
Retrieves the full path of the current document. User is responsible to allocate a buffer which is large enough. MAX_PATH is suggested to use.
Parameters:
wParam [in] : size_t fullPathLen
lParam [out] : TCHAR * fullPath
Return value: : Returns True on success and False if provided fullPath buffer is not large enough
Gets the full path file name from the given bufferID. First call should be made with buffer set to NULL to retrieve the actual size needed. Second call is sent with correctly allocated buffer, +1 for trailing null, to retrieve the full path file name.
Parameters:
wParam [in] : int bufferID
lParam [out] : TCHAR * buffer
Return value: : Returns -1 if bufferID does not exist, otherwise the number of chars copied/to copy.
Retrieves the description of the current language used. First call should be made with buffer set to NULL to retrieve the actual size needed. Second call is sent with correctly allocated buffer to retrieve the description.
Parameters:
wParam [in] : int langTypeID
lParam [out] : TCHAR* buffer
Return value: : Returns The number of characters needed or copied
Retrieves the name of the current language used. First call should be made with buffer set to NULL to retrieve the actual size needed. Second call is sent with correctly allocated buffer to retrieve the language name.
Parameters:
wParam [in] : int langTypeID
lParam [out] : TCHAR* buffer
Return value: : Returns The number of characters needed or copied
Get line number margin width in dynamic width mode (LINENUMWIDTH_DYNAMIC) or constant width mode (LINENUMWIDTH_CONSTANT)
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns the line number margin width mode, either the LINENUMWIDTH_DYNAMIC or LINENUMWIDTH_CONSTANT value.
Retrieves either the plugin or the main menu handle of Notepad++.
Parameters:
wParam [in] : int whichMenu, which can be 0 (plugin menu) or 1 (main menu)
lParam [in] : int, must be zero.
Return value: : Returns the requested menu handle.
Retrieves the part of filename, without extension, of the current document. User is responsible to allocate a buffer which is large enough. MAX_PATH is suggested to use.
Parameters:
wParam [in] : size_t namePartLen
lParam [out] : TCHAR * namePart
Return value: : Returns True on success and False if provided namePart buffer is not large enough
Retrieves the number of files currently open
Parameters:
wParam [in] : int, must be zero.
lParam [in] : Integer of one of the following values:
Value Meaning
0 the total number of files opened in Notepad++
1 number of files opened in the main view
2 number of files opened in the second view
Return value: : Returns number of open files
Retrieves the number of files to load in the session sessionFileName. sessionFileName should be a full path name of an xml file.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : const TCHAR * sessionFileName
Return value: : Returns 0 if sessionFileName is NULL or an empty string else the number of files.
Retrieves the number of user defined languages and, optionally, the starting menu id. Note, udlID is optional, if not used set it to 0, otherwise an integer pointer is needed to retrieve the menu identifier.
Parameters:
wParam [in] : int, must be zero.
lParam [out] : INT* udlID
Return value: : Returns The number of user defined languages identified
Retrieves the full path of the directory where the Notepad++ binary is located. User is responsible to allocate a buffer which is large enough. MAX_PATH is suggested to use.
Parameters:
wParam [in] : size_t nppDirLen
lParam [out] : TCHAR * nppDir
Return value: : Returns True on success and False if provided nppDir buffer is not large enough
Retrieves the full path of the Notepad++ executable.
Parameters:
wParam [in] : INT length
lParam [out] : TCHAR* buffer
Return value: : Returns True if the provided buffer size was big enough to write the full path to it, False otherwise.
Retrieves the current Notepad++ version. The value is made up of 2 parts: the major version (the high word) and minor version (the low word). For example, 4.7.5 is encoded like: HIWORD(version) == 4 LOWORD(version) == 75 Note that this message is supported by the v4.7 or higher version. Earlier versions return 0.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns a LONG value containing the current version.
Retrieves the open files of both views. User is responsible to allocate an big enough fileNames array.
Parameters:
wParam [out] : TCHAR ** fileNames, receives the full path names of all the opened files in Notepad++
lParam [in] : int nbFile, is the size of the fileNames array. Get this value by using NPPM_NBOPENFILES message with constant ALL_OPEN_FILES, then allocate fileNames array with this value.
Return value: : Returns The number of files copied into fileNames array.
Retrieves the open files of the main view. User is responsible to allocate an big enough fileNames array.
Parameters:
wParam [out] : TCHAR ** fileNames, receives the full path names of the opened files in the primary view
lParam [in] : int nbFile, is the size of the fileNames array. Get this value by using NPPM_NBOPENFILES message with constant PRIMARY_VIEW, then allocate fileNames array with this value.
Return value: : Returns The number of files copied into fileNames array.
Retrieves the open files of the secondary view. User is responsible to allocate an big enough fileNames array.
Parameters:
wParam [out] : TCHAR ** fileNames, receives the full path names of the opened files in the second view
lParam [in] : int nbFile, is the size of your fileNames array. You should get this value by using NPPM_NBOPENFILES message with constant SECOND_VIEW, then allocate fileNames array with this value.
Return value: : Returns The number of files copied into fileNames array.
Retrieves the plugin home root path. First call should be made with length set to 0 and buffer set to NULL to retrieve the actual size of the path. Second call sends the correct length and allocated buffer, both +1 for trailing NULL, to get the path name.
Parameters:
wParam [in] : SIZE_T length
lParam [out] : TCHAR* buffer
Return value: : Returns the number of TCHAR copied to buffer without trailing NULL.
Retrieves the path of the plugin config directory. User is responsible to allocate a buffer which is large enough. MAX_PATH is suggested to use.
Parameters:
wParam [in] : int strLen
lParam [out] : TCHAR *pluginsConfDir
Return value: : Returns True
Gets 0-based document position from given buffer ID, which is held in the 30 lowest bits of the return value on success. Bit 30 indicates which view has the buffer (clear for main view, set for sub view).
Parameters:
wParam [in] : int bufferID
lParam [in] : int, must be zero.
Return value: : Returns -1 if bufferID doesn't exist else the position.
Get settings on cloud path. It's useful if plugins want to store its settings on Cloud, if this path is set. (added v7.9.2).
First call should be made with buffer set to NULL to retrieve the actual size needed. Second call is sent with correctly allocated buffer, +1 for trailing null, to retrieve the full path file name.
Parameters:
wParam [in] : size_t strLen, maximum bytes to read for the path string, including the final NULL byte
lParam [out] : TCHAR *settingsOnCloudPath, the path for cloud settings obtained by this message
Return value: : Returns the length of the path string
Retrieves the files' full path name from a session file.
Parameters:
wParam [out] : TCHAR ** sessionFileArray, the array in which the files' full path of the same group are written. To allocate the array with the proper size, send message NPPM_GETNBSESSIONFILES.
lParam [in] : const TCHAR * sessionFileName, the path to the session file from which you retrieve the files
Return value: : Returns True
Gets the mapped plugin command shortcut. May be called after getting NPPN_READY notification.
Parameters:
wParam [in] : int cmdID
lParam [out] : ShortcutKey * sk, which is defined as
struct ShortcutKey {
bool _isCtrl;
bool _isAlt;
bool _isShift;
UCHAR _key;
}
Return value: : Returns True if this function call is successful and shortcut is enable, otherwise False
Retrieves the windows operating system version.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns a value of enum winVer. Possible values are
- WV_UNKNOWN
- WV_WIN32S
- WV_95
- WV_98
- WV_ME
- WV_NT
- WV_W2K
- WV_XP
- WV_S2003
- WV_XPX64
- WV_VISTA
Either hides or shows the menubar.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : BOOL hideOrNot
Return value: : Returns the previous status before this operation.
Either hides or shows the statusbar.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : BOOL hideOrNot
Return value: : Returns the previous status before this operation.
Either hides or shows the tabbar.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : BOOL hideOrNot
Return value: : Returns the previous status before this operation.
Either hides or shows the toolbar.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : BOOL hideOrNot
Return value: : Returns the previous status before this operation.
Checks the visibility of the document switcher window.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns True if the document switcher is currently shown, False otherwise
NPPM_ISMENUHIDDEN
Retrieves the current status of menubar.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns True if the menubar is hidden, False otherwise.
NPPM_ISSTATUSBARHIDDEN
Retrieves the current status of the statusbar.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns True if the status bar is hidden, False otherwise.
NPPM_ISTABBARHIDDEN
Retrieves the current status of tabbar.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns True if the tabbar is hidden, False otherwise.
NPPM_ISTOOLBARHIDDEN
Retrieves the current status of toolbar.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns True if the toolbar is hidden, False otherwise.
Triggers the Find in files dialog.
Parameters:
wParam [in] : TCHAR * dir2Search or NULL
lParam [in] : TCHAR * filter or NULL
Return value: : Returns True
Opens all files of same session in Notepad++ via a xml format session file sessionFileName.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : const TCHAR * sessionFileName
Return value: : Returns True
Makes the current document dirty, aka sets the save state to unsaved.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns True
Calls all possible Notepad++ menu commands.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int commandID, see menuCmdID.h for all possible values.
Return value: : Returns True
For each created dialog in your plugin, you should register it (and unregister while destroy it) to Notepad++ by using this message. If this message is ignored, then your dialog won't react with the key stroke messages such as TAB key. For the good functioning of your plugin dialog, you're recommended to not ignore this message.
Parameters:
wParam [in] : int op, the operation mode. MODELESSDIALOGADD is to register and MODELESSDIALOGREMOVE is to unregister.
lParam [in] : HWND hDlg, is the handle of the dialog to be registered
Return value: : Returns True
Allows the communication between 2 plugins. For example, plugin X can execute a command of plugin Y if plugin X knows the command ID and the file name of plugin Y.
Parameters:
wParam [in] : TCHAR * destModuleName, is the complete module name (with the extesion .dll) of plugin with which you want to communicate (plugin Y).
lParam [out] : CommunicationInfo * info
struct CommunicationInfo {
long internalMsg;
const TCHAR * srcModuleName;
void * info; // defined by plugin
};
: internalMsg is an integer defined by plugin Y, known by plugin X, identifying the message being sent. : srcModuleName is the complete module name (with the extesion .dll) of caller(plugin X). : info is defined by plugin, the informations to be exchanged between X and Y. It's a void pointer so it should be defined by plugin Y and known by plugin X. The returned value is TRUE if Notepad++ found the plugin by its module name (destModuleName), and pass the info (communicationInfo) to the module. The returned value is FALSE if no plugin with such name is found.
Return value: : Returns True if Notepad++ found the plugin by its module name (destModuleName), and pass the info (communicationInfo) to the module, False otherwise.
Reloads the document with the given bufferID. If doAlertOrNot is True, then a message box will display to ask user to reload the document, otherwise document will be loaded without asking user.
Parameters:
wParam [in] : int bufferID
lParam [in] : BOOL doAlertOrNot
Return value: : Returns True on success, False otherwise
Reloads the file indicated by filePathName2Reload.
Parameters:
wParam [in] : BOOL withAlert, if True then an alert message box will be launched.
lParam [in] : TCHAR *filePathName2Reload
Return value: : Returns True
Removes the assigned shortcut mapped to cmdID.
Parameters:
wParam [in] : int32 cmdID
lParam [in] : int, must be zero.
Return value: : Returns True if function call is successful, False otherwise.
Saves all opened documents.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns True
Saves the current document.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int, must be zero.
Return value: : Returns True
Saves the current file. saveAsCopy must be either 0 to save, or 1 to save a copy of the current filename.
Parameters:
wParam [in] : int saveAsCopy
lParam [in] : TCHAR* filename
Return value: : Returns True on success, False otherwise
Saves the current opened files in Notepad++ as a group of files (session) as an xml file. The xml full path name has to be provided by sessionFileName.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : const TCHAR *sessionFileName
Return value: : Returns True
Saves a specific file. filename must be the full file path for the file to be saved.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : const TCHAR* filename
Return value: : Returns True on success False otherwise
Creates an session file for a defined set of files. sessionInfo is a pointer to sessionInfo structure. Note, contrary to NPPM_SAVECURRENTSESSION, which saves the current opened files, this call can be used to freely define any file which should be part of a session.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : sessionInfo*
Return value: : Returns On success a TCHAR* to full path of the session filename to be saved or NULL otherwise
Sets the document encoding for the given bufferID. Can only be done on new, unedited files.
Parameters:
wParam [in] : int bufferID
lParam [in] : UniMode encoding
Return value: : Returns True on success, False otherwise.
Sets format to the document with the given bufferID.
Parameters:
wParam [in] : int bufferID
lParam [in] : formatType format
Return value: : Returns True on success, False otherwise.
Sets the language type of the document based on the given bufferID. See enum LangType for valid values, L_USER and L_EXTERNAL are not supported.
Parameters:
wParam [in] : int bufferID
lParam [in] : LangType type2Set
Return value: : Returns True on success, False otherwise.
Sets a new language type to the current used document.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int langType, please see the enum LangType for all possible values.
Return value: : Returns True
Extends the Scintilla window with an extra style. If value is True adds an additional sunken edge style to the Scintilla window else it removes the extended style from the window. See MSDN Extended Window Styles for more information.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : BOOL value
Return value: : Returns True
Set line number margin width in dynamic width mode (LINENUMWIDTH_DYNAMIC) or constant width mode (LINENUMWIDTH_CONSTANT). It may help some plugins to disable non-dynamic line number margins width to have a smooth visual effect while vertical scrolling the content in Notepad++
Parameters:
wParam [in] : int, must be zero.
lParam [in] : int widthMode, must be one of the values LINENUMWIDTH_DYNAMIC or LINENUMWIDTH_CONSTANT.
Return value: : Returns True on success, False on failure
Sets or removes the check on a menu item.
Parameters:
wParam [in] : int cmdID, is the command ID which corresponds to the menu item
lParam [in] : BOOL doCheck
Return value: : Returns True
Uses underlying Scintilla command SCI_SETFONTQUALITY to manage the font quality. If value is True, this message sets SC_EFF_QUALITY_LCD_OPTIMIZED else SC_EFF_QUALITY_DEFAULT
Parameters:
wParam [in] : int, must be zero.
lParam [in] : BOOL value
Return value: : Returns True
Sets value in the specified field of a statusbar.
Parameters:
wParam [in] : int field, possible values are
STATUSBAR_DOC_TYPE 0
STATUSBAR_DOC_SIZE 1
STATUSBAR_CUR_POS 2
STATUSBAR_EOF_FORMAT 3
STATUSBAR_UNICODE_TYPE 4
STATUSBAR_TYPING_MODE 5
lParam [out] : TCHAR * value, pointer to the new value.
Return value: : Returns 0 on failure, nonzero on success
Switches to the document which matches with the given filePathName2switch.
Parameters:
wParam [in] : int, must be zero.
lParam [in] : TCHAR *filePathName2switch
Return value: : Returns True
Triggers the tabbar context menu for the given view and index.
Parameters:
wParam [in] : int whichView
lParam [in] : int index2Activate
Return value: : Returns True
A notification is sent using a WM_NOTIFY message and therefore uses the NMHDR structure.
The three structure fields are, basically, three integer values. hwndFrom and idFrom holding the provided information of the notification. The integers might be pointers to structures/arrays, which, if present, are documented. code is always set to the ID of the Notification.
The notification IDs for each of these named notifications can be found in the source code in Notepad_plus_msgs.h.
Most of the time hwndFrom is set to hwndNpp which represents the window handle of the current Notepad++ instance. BufferID, mostly used in idFrom, refers to an ID which uniquely identifies a document A 0 (NULL) in either hwndFrom or idFrom indicate that the field is unused.
The general layout of the following notifications look like this
NOTIFICATION NAME Description
Fields : code : hwndFrom : idFrom
NOTIFICATION NAME gets replaced by a concrete Notepad++ notification like NPPN_READY. Description informs about the usage of the notification and provides additional information if needed. Fields are the parameters to be provided by the notification.
To notify plugins that Npp shutdown has been triggered, files have not been closed yet
Fields:
code: NPPN_BEFORESHUTDOWN
hwndFrom: hwndNpp
idFrom: 0
To notify plugins that a buffer was activated (put to foreground).
Fields:
code: NPPN_BUFFERACTIVATED
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that Npp shutdown has been cancelled
Fields:
code: NPPN_CANCELSHUTDOWN
hwndFrom: hwndNpp
idFrom: 0
To notify plugins that document order is changed
Fields:
code: NPPN_DOCORDERCHANGED
hwndFrom: newIndex
idFrom: BufferID
To notify plugins that the current file is about to be closed
Fields:
code: NPPN_FILEBEFORECLOSE
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that file is to be deleted
Fields:
code: NPPN_FILEBEFOREDELETE
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that the current file is about to be loaded
Fields:
code: NPPN_FILEBEFORELOAD
hwndFrom: hwndNpp
idFrom: NULL
To notify plugins that the current file is about to be opened
Fields:
code: NPPN_FILEBEFOREOPEN
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that file is to be renamed
Fields:
code: NPPN_FILEBEFORERENAME
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that the current file is about to be saved
Fields:
code: NPPN_FILEBEFORESAVE
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that the current file is just closed
Fields:
code: NPPN_FILECLOSED
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that file has been deleted
Fields:
code: NPPN_FILEDELETED
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that file deletion has failed
Fields:
code: NPPN_FILEDELETEFAILED
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that file open operation failed
Fields:
code: NPPN_FILELOADFAILED
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that the current file is just opened
Fields:
code: NPPN_FILEOPENED
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that file rename has been cancelled
Fields:
code: NPPN_FILERENAMECANCEL
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that file has been renamed
Fields:
code: NPPN_FILERENAMED
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that the current file is just saved
Fields:
code: NPPN_FILESAVED
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that the language in the current doc is just changed.
Fields:
code: NPPN_LANGCHANGED
hwndFrom: hwndNpp
idFrom: BufferID
To notify plugins that current document change the readonly status,
Fields:
code: NPPN_READONLYCHANGED
hwndFrom: BufferID
idFrom: docStatus, either one or the combination of the following values
DOCSTATUS_READONLY 1
DOCSTATUS_BUFFERDIRTY 2
To notify plugins that all the procedures of launchment of notepad++ are done.
Fields:
code: NPPN_READY
hwndFrom: hwndNpp
idFrom: 0
To notify plugins that plugin command shortcut is remapped.
Fields:
code: NPPN_SHORTCUTREMAPPED
hwndFrom: ShortcutKeyStructurePointer, which is defined as
struct ShortcutKey {
bool _isCtrl
bool _isAlt
bool _isShift
UCHAR _key
}
idFrom: cmdID, the ID of the command shortcut
To notify plugins that Notepad++ is about to be shutdowned.
Fields:
code: NPPN_SHUTDOWN
hwndFrom: hwndNpp
idFrom: 0
To notify plugins that a snapshot dirty file is loaded on startup
Fields:
code: NPPN_SNAPSHOTDIRTYFILELOADED
hwndFrom: NULL
idFrom: BufferID
To notify plugins that toolbar icons can be registered
Fields:
code: NPPN_TBMODIFICATION
hwndFrom: hwndNpp
idFrom: 0
To notify plugins that user initiated a WordStyleDlg change.
Fields:
code: NPPN_WORDSTYLESUPDATED
hwndFrom: hwndNpp
idFrom: BufferID