Table of Contents

Enum NppMsg

Namespace
Npp.DotNet.Plugin
Assembly
Npp.DotNet.Plugin.dll
public enum NppMsg : uint

Fields

ALL_OPEN_FILES = 0

See NPPM_GETNBOPENFILES

CURRENT_COLUMN = 9
CURRENT_DIRECTORY = 2
CURRENT_LINE = 8
CURRENT_LINESTR = 12
CURRENT_WORD = 6
DOCSTATUS_BUFFERDIRTY = 2
DOCSTATUS_READONLY = 1
EXT_PART = 5
FILE_NAME = 3
FULL_CURRENT_PATH = 1
GETFILENAMEATCURSOR = 11
LINENUMWIDTH_CONSTANT = 1

See NPPM_SETLINENUMBERWIDTHMODE

LINENUMWIDTH_DYNAMIC = 0

See NPPM_SETLINENUMBERWIDTHMODE

MAIN_VIEW = 0
MODELESSDIALOGADD = 0

See NPPM_MODELESSDIALOG

MODELESSDIALOGREMOVE = 1

See NPPM_MODELESSDIALOG

NAME_PART = 4
NPPMAINMENU = 1

See NPPM_GETMENUHANDLE

NPPMSG = 2024
NPPM_ACTIVATEDOC = 2052

BOOL NPPM_ACTIVATEDOC(int inView, int index2Activate)
Switch to the document in the given view with the given index2Activate.

wParam (UIntPtr) [in]: inView - MAIN_VIEW (0) or SUB_VIEW (1)

lParam (IntPtr) [in]: index2Activate - index (in the given view) of the document to be activated

Returns TRUE.

NPPM_ADDSCNMODIFIEDFLAGS = 2141

BOOL NPPM_ADDSCNMODIFIEDFLAGS(0, unsigned long scnMotifiedFlags2Add)
Add the necessary ModificationFlags so that your plugin will receive additional SCN_MODIFIED notifications.

wParam (UIntPtr) [in]: 0 (not used)

lParam (IntPtr) [in]: scnMotifiedFlags2Add - ModificationFlags to add

Example
extern "C" __declspec(dllexport) void beNotified(SCNotification* notifyCode)
{
  switch (notifyCode->nmhdr.code)
  {
    case NPPN_READY:
    {
      // Add SC_MOD_BEFOREDELETE and SC_MOD_BEFOREINSERT to listen to the 2 events of SCN_MODIFIED
      ::SendMessage(nppData._nppHandle, NPPM_ADDSCNMODIFIEDFLAGS, 0, SC_MOD_BEFOREDELETE | SC_MOD_BEFOREINSERT);
      break;
    }
    // ...
  }
// ...
}

Returns TRUE.

By default, Notepad++ only forwards the 5 flags/events in NPP_DEFAULT_SC_MOD_MASK. If your plugin needs to process other ModificationFlags events, you should add the required flags by sending this message after the NPPN_READY notification has been sent, or only when your plugin needs to listen to specific events (to avoid penalizing Notepad++'s performance). Just ensure this message is sent only once.

Added in 8.7.7
[Obsolete("Replaced by NPPM_ADDTOOLBARICON_DEPRECATED", true)] NPPM_ADDTOOLBARICON = 2065
NPPM_ADDTOOLBARICON_DEPRECATED = 2065

BOOL NPPM_ADDTOOLBARICON_DEPRECATED(UINT pluginCmdID, toolbarIcons* iconHandles)
Add an icon to the toolbar.

wParam (UIntPtr) [in]: pluginCmdID - the plugin command ID corresponding to the toolbar item whose icon will be set; see CmdID

lParam (IntPtr) [in]: iconHandles - pointer to a ToolbarIcon structure. 2 formats (ICO and BMP) are needed. Both handles should be set to ensure correct display in case the user selects a custom toolbar icon set

Returns TRUE.

Use NPPM_ADDTOOLBARICON_FORDARKMODE instead.

NPPM_ADDTOOLBARICON_FORDARKMODE = 2125

BOOL NPPM_ADDTOOLBARICON_FORDARKMODE(UINT pluginCmdID, toolbarIconsWithDarkMode* iconHandles)
Add an icon with a dark mode variant to the toolbar.

wParam (UIntPtr) [in]: pluginCmdID - the plugin command ID corresponding to the toolbar item whose icon will be set; CmdID

lParam (IntPtr) [in]: iconHandles - a pointer to a ToolbarIconDarkMode structure

Returns TRUE.

Added in 8.0

NPPM_ALLOCATECMDID = 2105

BOOL NPPM_ALLOCATECMDID(int numberRequested, int* startNumber)
Allocate a consecutive number of menu item IDs for a plugin.

wParam (UIntPtr) [in]: numberRequested - the number of IDs requested for reservation

lParam (IntPtr) [out]: startNumber - will be set to the initial command ID if successful

For example, if a plugin needs 4 menu item IDs, the following code can be used:
int idBegin;
BOOL isAllocatedSuccessful = ::SendMessage(nppData._nppHandle, NPPM_ALLOCATECMDID, 4, &idBegin);

If isAllocatedSuccessful is TRUE, and the value of idBegin is 46581, then menu item IDs 46581, 46582, 46583 and 46584 are reserved by Notepad++, and they are safe to be used by the plugin.

Returns TRUE if successful, FALSE otherwise; startNumber will also be set to 0 if unsuccessful.

The obtained menu IDs are guaranteed not to conflict with other plugins.

NPPM_ALLOCATEINDICATOR = 2137

BOOL NPPM_ALLOCATEINDICATOR(int numberRequested, int* startNumber)
Allocates an indicator number for a plugin.

wParam (UIntPtr) [in]: numberRequested - the ID number requested for reservation

lParam (IntPtr) [out]: startNumber - will be set to the initial command ID, if successful

For example, if a plugin needs 1 indicator ID, the following code can be used :
int idBegin;
BOOL isAllocatedSuccessful = ::SendMessage(nppData._nppHandle, NPPM_ALLOCATEINDICATOR, 1, &idBegin);

If isAllocatedSuccessful is TRUE, and the value of idBegin is 7, then indicator ID 7 is reserved by Notepad++, and it is safe to be used by the plugin.

Returns TRUE if successful, FALSE otherwise; startNumber will also be set to 0 if unsuccessful.

If a plugin needs to add an indicator, it should reserve it using this API, in order to prevent a conflict with other plugins.

Added in 8.5.6
NPPM_ALLOCATEMARKER = 2106

BOOL NPPM_ALLOCATEMARKER(int numberRequested, int* startNumber)
Allocate a consecutive number of marker IDs for a plugin.

wParam (UIntPtr) [in]: numberRequested - the number of IDs requested for reservation

lParam (IntPtr) [out]: startNumber - will be set to the initial command ID if successful

For example, if a plugin needs 3 marker IDs, the following code can be used:
int idBegin;
BOOL isAllocatedSuccessful = ::SendMessage(nppData._nppHandle, NPPM_ALLOCATEMARKER, 3, &idBegin);

If isAllocatedSuccessful is TRUE, and the value of idBegin is 16, then marker IDs 16, 17 and 18 are reserved by Notepad++, and they are safe to be used by the plugin.

Returns TRUE if successful, FALSE otherwise; startNumber will also be set to 0 if unsuccessful.

If a plugin needs to add a marker on Notepad++'s Scintilla marker margin, it should reserve it using this API, in order to prevent a conflict with other plugins.

[Obsolete("Replaced by NPPM_ALLOCATESUPPORTED_DEPRECATED", true)] NPPM_ALLOCATESUPPORTED = 2104
NPPM_ALLOCATESUPPORTED_DEPRECATED = 2104

BOOL NPPM_ALLOCATESUPPORTED_DEPRECATED(0, 0)
Get the status of support for the NPPM_ALLOCATECMDID API.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns TRUE if NPPM_ALLOCATECMDID is supported.

Used to identify if subclassing is necessary. This message was added (in 2010) only for checking if NPPM_ALLOCATECMDID was supported; it is no longer needed.

NPPM_CREATELEXER = 2134

void* NPPM_CREATELEXER(0, const wchar_t* lexer_name)
Get an ILexer pointer created by Lexilla. This calls lexilla's CreateLexer() function so that plugins can set the lexer for a Scintilla instance created by NPPM_CREATESCINTILLAHANDLE.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: lexer_name - the name of the lexer

Returns the ILexer pointer.

Added in 8.4.3

NPPM_CREATESCINTILLAHANDLE = 2044

HWND NPPM_CREATESCINTILLAHANDLE(0, HWND hParent)
Get a handle to the active Scintilla control.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: hParent - if set (i.e., not NULL), it will be the parent window of this created Scintilla handle, otherwise the parent window is Notepad++

Returns the created Scintilla handle.

NPPM_DARKMODESUBCLASSANDTHEME = 2136

ULONG NPPM_DARKMODESUBCLASSANDTHEME(ULONG dmFlags, HWND hwnd)
Make the plugin dialog with the given handle participate in automatic dark mode theming. Subclassing will be applied automatically unless the DWS_USEOWNDARKMODE flag is used.

wParam (UIntPtr) [in]: dmFlags - either dmfInit or dmfHandleChange

lParam (IntPtr) [in]: hwnd - the dialog handle of the plugin

Examples
  • after controls have been initialized (i.e., WM_INITDIALOG or WM_CREATE has been handled, or ::CreateWindow() has been called):
    auto success = static_cast<ULONG>(::SendMessage(nppData._nppHandle, NPPM_DARKMODESUBCLASSANDTHEME, static_cast<WPARAM>(NppDarkMode::dmfInit), reinterpret_cast<LPARAM>(mainHwnd)));
  • after a change of dark mode preference:
    extern "C" __declspec(dllexport) void beNotified(SCNotification * notifyCode)
    {
       switch (notifyCode->nmhdr.code)
       {
          case NPPN_DARKMODECHANGED:
          {
           ::SendMessage(nppData._nppHandle, NPPM_DARKMODESUBCLASSANDTHEME, static_cast<WPARAM>(dmfHandleChange), reinterpret_cast<LPARAM>(mainHwnd));
           ::SetWindowPos(mainHwnd, NULLlptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
           // to redraw titlebar and window
           break;
          }
       }
    }

Returns the combination of dmFlags, if successful.

Docking panels are always automatically subclassed and do not need to call this API.

Might not work properly with C# plugins.

Added in 8.5.4
NPPM_DECODESCI = 2051

int NPPM_DECODESCI(int inView, 0)
Change the document encoding of the given view to ANSI.

wParam (UIntPtr) [in]: inView - MAIN_VIEW (0) or SUB_VIEW (1)

lParam (IntPtr): 0 (not used)

Returns the old UniMode - see NPPM_ENCODESCI.

[Obsolete("Replaced by NPPM_DESTROYSCINTILLAHANDLE_DEPRECATED", true)] NPPM_DESTROYSCINTILLAHANDLE = 2045
NPPM_DESTROYSCINTILLAHANDLE_DEPRECATED = 2045

BOOL NPPM_DESTROYSCINTILLAHANDLE_DEPRECATED(0, HWND hScintilla)
Does nothing and always returns TRUE. Notepad++ will deallocate every created Scintilla control on exit.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: hScintilla - Scintilla handle

Returns TRUE.

This message exists for backward compatibility only.

NPPM_DISABLEAUTOUPDATE = 2119

BOOL NPPM_DISABLEAUTOUPDATE(0, 0)
Disable automatic updates of Notepad++.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns TRUE.

NPPM_DMMGETPLUGINHWNDBYNAME = 2067

HWND NPPM_DMMGETPLUGINHWNDBYNAME(const wchar_t* windowName, const wchar_t* moduleName)
Retrieve the handle of the docked dialog corresponding to the given windowName and moduleName.

wParam (UIntPtr) [in]: windowName - if NULL, the handle of the first window matching moduleName will be returned

lParam (IntPtr) [in]: moduleName - if NULL, the return value is also NULL

Returns NULL if moduleName is NULL. If windowName is NULL, the handle of the first window matching moduleName is returned.

Use this API to communicate with another plugin's docking dialog.

NPPM_DMMHIDE = 2055

BOOL NPPM_DMMHIDE(0, HWND hDlg)
Hide a dialog that was previously registered with NPPM_DMMREGASDCKDLG.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: hDlg - the handle of the dialog to hide

Returns TRUE.

NPPM_DMMREGASDCKDLG = 2057

BOOL NPPM_DMMREGASDCKDLG(0, tTbData* pData)
Register a plugin dialog with the Docking Manager.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: pData - a pointer to a NppTbData structure. The fields which, at minimum, need to be filled out are HClient, PszName, DlgID, UMask and PszModuleName. Note that RcFloat and IPrevCont should not be filled. They are used internally.

Returns TRUE.

NPPM_DMMSHOW = 2054

BOOL NPPM_DMMSHOW(0, HWND hDlg)
Show a dialog that was previously registered with NPPM_DMMREGASDCKDLG.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: hDlg - the handle of the dialog to show

Returns TRUE.

NPPM_DMMUPDATEDISPINFO = 2056

BOOL NPPM_DMMUPDATEDISPINFO(0, HWND hDlg)
Redraw the title bar of a dialog that was previously registered with NPPM_DMMREGASDCKDLG.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: hDlg - the handle of the dialog to redraw

Returns TRUE.

NPPM_DMMVIEWOTHERTAB = 2059

BOOL NPPM_DMMVIEWOTHERTAB(0, wchar_t* name)
Show the docked dialog with the given name (or switch to the tab of that dialog in a docking group).

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: name - the name used to register the dialog (i.e., the PszName of the NppTbData passed to NPPM_DMMREGASDCKDLG)

Returns TRUE.

NPPM_DOCLISTDISABLEEXTCOLUMN = 2113

BOOL NPPM_DOCLISTDISABLEEXTCOLUMN(0, BOOL disableOrNot)
Disable or enable the file extension column of the Document List.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: disableOrNot - if TRUE, the extension column is hidden, otherwise it is shown

Returns TRUE.

NPPM_DOCLISTDISABLEPATHCOLUMN = 2126

BOOL NPPM_DOCLISTDISABLEPATHCOLUMN(0, BOOL disableOrNot)
Disable or enable the path column of the Document List.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: disableOrNot - if TRUE, the path column is hidden, otherwise it is shown

Returns TRUE.

NPPM_DOOPEN = 2101

BOOL NPPM_DOOPEN(0, const wchar_t* fullPathName2Open)
Open the file with the given fullPathName2Open. If it is already open in Notepad++, it will be activated and become the current document.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: fullPathName2Open - full path name of the file to be opened

Returns TRUE if the operation is successful, otherwise FALSE.

NPPM_ENCODESCI = 2050

int NPPM_ENCODESCI(int inView, 0)
Change the document encoding of the given view.

wParam (UIntPtr) [in]: inView - MAIN_VIEW (0) or SUB_VIEW (1)

lParam (IntPtr): 0 (not used)

Returns the new UniMode, with the following value:

0: ANSI
1: UTF-8 with BOM
2: UTF-16 Big Ending with BOM
3: UTF-16 Little Ending with BOM
4: UTF-8 without BOM
5: uni7Bit
6: UTF-16 Big Ending without BOM
7: UTF-16 Little Ending without BOM

NPPM_GETAPPDATAPLUGINSALLOWED = 2111

BOOL NPPM_GETAPPDATAPLUGINSALLOWED(0, 0)
Check to see if loading plugins from "%APPDATA%..\Local\Notepad++\plugins" is allowed.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns TRUE if loading plugins from %APPDATA% is allowed, FALSE otherwise.

NPPM_GETBOOKMARKID = 2135

int NPPM_GETBOOKMARKID(0, 0)
Get a stable bookmark ID.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns the bookmark ID.

This API guarantees you always get the right bookmark ID even if it's been changed by a newer version of Notepad++.

Added in 8.4.7
NPPM_GETBUFFERENCODING = 2090

int NPPM_GETBUFFERENCODING(UINT_PTR bufferID, 0)
Get the encoding of the document with the given buffer ID.

wParam (UIntPtr) [in]: bufferID - buffer ID of the document

lParam (IntPtr): 0 (not used)

Returns -1 on error, otherwise the UniMode, with the following value:

0: ANSI
1: UTF-8 with BOM
2: UTF-16 Big Ending with BOM
3: UTF-16 Little Ending with BOM
4: UTF-8 without BOM
5: uni7Bit
6: UTF-16 Big Ending without BOM
7: UTF-16 Little Ending without BOM

NPPM_GETBUFFERFORMAT = 2092

int NPPM_GETBUFFERFORMAT(UINT_PTR bufferID, 0)
Get the EOL format of the document with the given buffer ID.

wParam (UIntPtr) [in]: bufferID - buffer ID of the document

lParam (IntPtr): 0 (not used)

Returns -1 on error, otherwise one of the following EOL formats:

0: Windows (CRLF)
1: Macos (CR)
2: Unix (LF)
3. Unknown

NPPM_GETBUFFERIDFROMPOS = 2083

UINT_PTR NPPM_GETBUFFERIDFROMPOS(int index, int iView)
Get the buffer ID of the document in the given view with the given index.

wParam (UIntPtr) [in]: index - 0-based index of the document

lParam (IntPtr) [in]: inView - MAIN_VIEW or SUB_VIEW

Returns NULL if invalid, otherwise the buffer ID of the document.

NPPM_GETBUFFERLANGTYPE = 2088

int NPPM_GETBUFFERLANGTYPE(UINT_PTR bufferID, 0)
Get the LangType associated with the current document matching the given buffer ID.

wParam (UIntPtr) [in]: bufferID - the buffer ID of the document

lParam (IntPtr): 0 (not used)

Returns a LangType value, or -1 on error.

NPPM_GETCURRENTBUFFERID = 2084

UINT_PTR NPPM_GETCURRENTBUFFERID(0, 0)
Get the active document's buffer ID.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns the buffer ID of the active document.

NPPM_GETCURRENTCMDLINE = 2133

int NPPM_GETCURRENTCMDLINE(size_t strLen, wchar_t* commandLineStr)
Get the current command line string.

wParam (UIntPtr) [in]: strLen - buffer length of commandLineStr

lParam (IntPtr) [out]: commandLineStr - allocated command line string buffer

Returns the number of UTF-16 characters copied/to copy.

Users should first call this API with commandLineStr set to NULL to get the required number of UTF-16 characters (not including the terminating NULL character), allocate the commandLineStr buffer with the value + 1, then call it again to get the current command line string.

Added in 8.4.2
NPPM_GETCURRENTCOLUMN = 4033

INT NPPM_GETCURRENTCOLUMN(0, 0);

Returns the caret's current position column.

NPPM_GETCURRENTDIRECTORY = 4026

See NPPM_GETFULLCURRENTPATH

NPPM_GETCURRENTDOCINDEX = 2047

int NPPM_GETCURRENTDOCINDEX(0, int inView)
Get the index of the document currently open in the given view.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: inView - either MAIN_VIEW) or SUB_VIEW

Returns -1 if the view is invisible (hidden), otherwise the current document's index.

NPPM_GETCURRENTLANGTYPE = 2029

BOOL NPPM_GETCURRENTLANGTYPE(0, int* langType)
Get the LangType associated with the current document.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [out]: langType - see LangType for all valid values

Returns TRUE.

NPPM_GETCURRENTLINE = 4032

INT NPPM_GETCURRENTLINE(0, 0);

Returns the caret's current position line.

NPPM_GETCURRENTLINESTR = 4036

See NPPM_GETFULLCURRENTPATH

NPPM_GETCURRENTMACROSTATUS = 2130

MacroStatus NPPM_GETCURRENTMACROSTATUS(0, 0)
Get the current MacroStatus.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns a MacroStatus value:

  • 0: Idle - macro is not in use and it's empty
  • 1: RecordInProgress - macro is currently being recorded
  • 2: RecordingStopped - macro recording has been stopped
  • 3: PlayingBack - macro is currently being played back

Added in 8.3.3

NPPM_GETCURRENTNATIVELANGENCODING = 2103

int NPPM_GETCURRENTNATIVELANGENCODING(0, 0)
Get the code page associated with the current localization of Notepad++.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns the code page identifier of the current native language encoding.

NPPM_GETCURRENTSCINTILLA = 2028

BOOL NPPM_GETCURRENTSCINTILLA(0, int* iScintillaView)
Get the index of the currently active Scintilla view.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [out]: iScintillaView - either MAIN_VIEW or SUB_VIEW

Returns TRUE.

NPPM_GETCURRENTVIEW = 2112

int NPPM_GETCURRENTVIEW(0, 0)
Get the currently active view.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns the current edit view: either MAIN_VIEW or SUB_VIEW.

NPPM_GETCURRENTWORD = 4030

See NPPM_GETFULLCURRENTPATH

NPPM_GETDARKMODECOLORS = 2132

BOOL NPPM_GETDARKMODECOLORS (size_t cbSize, NppDarkMode::Colors* returnColors)
Get the color values of the active dark mode theme.

wParam (UIntPtr) [in]: cbSize - must be equal to sizeof(NppDarkMode::Colors)

lParam (IntPtr) [out]: returnColors - a pointer to a DarkMode.DarkModeColors structure

If calling this API fails (i.e., FALSE is returned), you may need to change the DarkMode.DarkModeColors structure as shown here.

Added in 8.4.1
NPPM_GETEDITORDEFAULTBACKGROUNDCOLOR = 2115

int NPPM_GETEDITORDEFAULTBACKGROUNDCOLOR(0, 0)
Get the editor's current default background color.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns the color as an integer in hex format 0x00bbggrr.

NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR = 2114

int NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR(0, 0)
Get the editor's current default foreground color.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns the color as an integer in hex format 0x00bbggrr.

[Obsolete("Use EnableThemeDialogTexture directly (uxtheme.h) instead", false)] NPPM_GETENABLETHEMETEXTUREFUNC = 2069

THEMEAPI NPPM_GETENABLETHEMETEXTUREFUNC(0, 0)
Get the function address of ::EnableThemeDialogTexture().

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns a procedure address, or NULL.

Deprecated since 8.4.9. Use EnableThemeDialogTexture() directly from uxtheme.h instead.

NPPM_GETEXTERNALLEXERAUTOINDENTMODE = 2127

BOOL NPPM_GETEXTERNALLEXERAUTOINDENTMODE(const wchar_t* languageName, ExternalLexerAutoIndentMode* autoIndentMode)
Get the ExternalLexerAutoIndentMode of the external lexer identified by languageName.

wParam (UIntPtr) [in]: languageName - name of an external lexer provided by a plugin

lParam (IntPtr) [out]: autoIndentMode - see NPPM_SETEXTERNALLEXERAUTOINDENTMODE

Returns TRUE on success, otherwise FALSE.

Added in 8.3.3

NPPM_GETEXTPART = 4029

See NPPM_GETFULLCURRENTPATH

NPPM_GETFILENAME = 4027

See NPPM_GETFULLCURRENTPATH

NPPM_GETFILENAMEATCURSOR = 4035

See NPPM_GETFULLCURRENTPATH

NPPM_GETFULLCURRENTPATH = 4025

BOOL NPPM_GETXXXXXXXXXXXXXXXX(size_t strLen, wchar_t* str)
where:

  • str is the allocated wchar_t array
  • strLen is the allocated array size

Returns TRUE when copying to the string buffer succeeds, otherwise FALSE (when, e.g., the allocated array size is too small).

NPPM_GETFULLPATHFROMBUFFERID = 2082

int NPPM_GETFULLPATHFROMBUFFERID(UINT_PTR bufferID, wchar_t* fullFilePath)
Get the full file path of the document with the given buffer ID.

wParam (UIntPtr) [in]: bufferID - the buffer ID of the document

lParam (IntPtr) [out]: fullFilePath - the allocated file path buffer

Returns -1 if no document with bufferID exists, otherwise the number of UTF-16 characters copied/to copy.

The user should first call this API with fullFilePath set to NULL to get the number of UTF-16 characters (not including the NULL character), allocate fullFilePath with the return value + 1, then call it again to get the file path.

NPPM_GETLANGUAGEDESC = 2108

int NPPM_GETLANGUAGEDESC(int langType, wchar_t* langDesc)
Get a short description of the programming language with the given langType.

wParam (UIntPtr) [in]: langType - a LangType value

lParam (IntPtr) [out]: langDesc - the allocated language description buffer

Returns the number of UTF-16 characters copied/to copy.

Users should first call this API with langDesc set to NULL to get the required number of UTF-16 characters (not including the terminating NULL character), allocate the langDesc buffer with the return value + 1, then call it again to get the description text.

NPPM_GETLANGUAGENAME = 2107

int NPPM_GETLANGUAGENAME(int langType, wchar_t* langName)
Get the name of the programming language associated with the given langType.

wParam (UIntPtr) [in]: langType - a LangType value

lParam (IntPtr) [out]: langName - the allocated language name buffer

Returns the number of UTF-16 characters copied/to copy.

Users should first call this API with langName set to NULL to get the required number of UTF-16 characters (not including the terminating NULL character), allocate the langName buffer with the return value + 1, then call it again to get the language name.

NPPM_GETLINENUMBERWIDTHMODE = 2124

int NPPM_GETLINENUMBERWIDTHMODE(0, 0)
Get the current line number margin width mode.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns the current line number margin width mode: either LINENUMWIDTH_DYNAMIC or LINENUMWIDTH_CONSTANT.

NPPM_GETMENUHANDLE = 2049

HMENU NPPM_GETMENUHANDLE(int menuChoice, 0)
Get a handle to the menu indicated by menuChoice.

wParam (UIntPtr) [in]: menuChoice - either the main menu (NPPMAINMENU) or the plugin menu (NPPPLUGINMENU)

lParam (IntPtr): 0 (not used)

Returns the desired menu handle (IntPtr): either the plugin menu handle or the Notepad++ main menu handle.

NPPM_GETNAMEPART = 4028

See NPPM_GETFULLCURRENTPATH

NPPM_GETNATIVELANGFILENAME = 2140

int NPPM_GETNATIVELANGFILENAME(size_t strLen, char* nativeLangFileName)
Get the name of the currently active XML localization file.

wParam (UIntPtr) [in]: strLen - buffer length of nativeLangFileName

lParam (IntPtr) [in]: nativeLangFileName - allocated language file name buffer

Returns the number of single-byte characters copied/to copy. If there's no localization file in use, 0 is returned.

Users should first call this API with nativeLangFileName set to NULL to get the required number of single-byte characters (not including the terminating NULL character), allocate the nativeLangFileName buffer with the return value + 1, then call it again to get the localization file name. Call this after the NPPN_READY notification has been sent.

Added in 8.7
NPPM_GETNBOPENFILES = 2031

int NPPM_GETNBOPENFILES(0, int iViewType)
Get the number of files currently open in the given view.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: iViewType - can be PRIMARY_VIEW, SECOND_VIEW or ALL_OPEN_FILES

Returns the number of opened files.

NPPM_GETNBSESSIONFILES = 2037

int NPPM_GETNBSESSIONFILES (BOOL* pbIsValidXML, wchar_t* sessionFileName)
Get the number of files listed in the session file with the given sessionFileName.

wParam (UIntPtr) [out]: pbIsValidXML - Since 8.6: TRUE if sessionFileName is valid XML, otherwise FALSE. If sessionFileName is a NULL pointer, this parameter is ignored

lParam (IntPtr) [in]: sessionFileName - the XML session file's full path

Returns the number of files listed in the XML session file.

NPPM_GETNBUSERLANG = 2046

int NPPM_GETNBUSERLANG(0, int* udlID)
Get the number of user-defined languages and, optionally, the starting menu id.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [optional]: udlID - 0, if not used; otherwise an integer pointer to retrieve the starting menu id

Returns the number of user-defined languages identified.

NPPM_GETNPPDIRECTORY = 4031

See NPPM_GETFULLCURRENTPATH

NPPM_GETNPPFULLFILEPATH = 4034

See NPPM_GETFULLCURRENTPATH

NPPM_GETNPPVERSION = 2074

int NPPM_GETNPPVERSION(BOOL ADD_ZERO_PADDING, 0)
Get the version of the currently running edition of Notepad++.

wParam (UIntPtr) [in]: ADD_ZERO_PADDING - Since 8.4.1: Whether or not to ensure that 100 >= LOWORD(version) <= 999

lParam (IntPtr): 0 (not used)

Return value:

  • HIWORD(returned_value) - 1st digit of the version
  • LOWORD(returned_value) - last 3 digits of the version
ADD_ZERO_PADDING == TRUE
version  | HIWORD | LOWORD
------------------------------
8.9.6.4  | 8      | 964
9        | 9      | 0
6.9      | 6      | 900
6.6.6    | 6      | 660
13.6.6.6 | 13     | 666
ADD_ZERO_PADDING == FALSE
version  | HIWORD | LOWORD
------------------------------
8.9.6.4  | 8      | 964
9        | 9      | 0
6.9      | 6      | 9
6.6.6    | 6      | 66
13.6.6.6 | 13     | 666

Changed in 8.4.1

NPPM_GETOPENFILENAMES = 2032

BOOL NPPM_GETOPENFILENAMES(wchar_t** fileNames, int nbFileNames)
Get the full path names of all files currently open in both views. The user must allocate a big enough fileNames array using NPPM_GETNBOPENFILES.

wParam (UIntPtr) [out]: fileNames - pre-allocated array of file paths

lParam (IntPtr) [in]: nbFileNames - the number of file paths in fileNames

Returns the number of files copied to the fileNames array.

NPPM_GETOPENFILENAMESPRIMARY = 2041

BOOL NPPM_GETOPENFILENAMESPRIMARY(wchar_t** fileNames, int nbFileNames)
Get the full path names of all files currently open in the main view. The user must allocate a big enough fileNames array using NPPM_GETNBOPENFILES.

wParam (UIntPtr) [out]: fileNames - pre-allocated array of file paths

lParam (IntPtr) [in]: nbFileNames - the number of file paths in fileNames

Returns the number of files copied to the fileNames array.

NPPM_GETOPENFILENAMESSECOND = 2042

BOOL NPPM_GETOPENFILENAMESSECOND(wchar_t** fileNames, int nbFileNames)
Get the full path names of all files currently open in the sub-view. The user must allocate a big enough fileNames array using NPPM_GETNBOPENFILES.

wParam (UIntPtr) [out]: fileNames - pre-allocated array of file paths

lParam (IntPtr) [in]: nbFileNames - the number of file paths in fileNames

Returns the number of files copied to the fileNames array.

NPPM_GETPLUGINHOMEPATH = 2121

int NPPM_GETPLUGINHOMEPATH(size_t strLen, wchar_t* pluginRootPath)
Get the root path of all the installed Notepad++ plugins. For example, the full path to a plugin's installation folder would be: <pluginRootPath>\<pluginFolderName>, where <pluginFolderName> is the name of the plugin without the ".dll" file extension.

wParam (UIntPtr) [in]: strLen - buffer length of pluginRootPath

lParam (IntPtr) [out]: pluginRootPath - the allocated buffer

Returns the number of UTF-16 characters copied/to copy, or 0 on failure.

Users should first call this API with pluginRootPath set to NULL to get the required number of UTF-16 characters (not including the terminating NULL character), allocate the pluginRootPath buffer with the return value + 1, then call it again to get the directory path.

NPPM_GETPLUGINSCONFIGDIR = 2070

int NPPM_GETPLUGINSCONFIGDIR(int strLen, wchar_t* str)
Get the user's plugin config directory path. Useful if plugins need to save/load configuration options across sessions.

wParam (UIntPtr) [in]: strLen - buffer length of str

lParam (IntPtr) [out]: str - the allocated buffer

When str is NULL, returns the number of UTF-16 characters to copy; when str is an allocated buffer, returns FALSE on failure, TRUE on success.

The user should first call this API with str set to NULL to get the number of UTF-16 characters (not including the NULL character), allocate str with the return value + 1, then call it again to get the directory path.

NPPM_GETPOSFROMBUFFERID = 2081

int NPPM_GETPOSFROMBUFFERID(UINT_PTR bufferID, int priorityView)
Get the position of the document with bufferID, searching in priorityView first.

wParam (UIntPtr) [in]: bufferID - the buffer ID of the document

lParam (IntPtr) [in]: priorityView - the target view. If bufferID cannot be found in the target view, the other view will be searched. If set to SUB_VIEW, the sub view will be searched first

Returns -1 if no document with bufferID exists, otherwise (VIEW << 30) | INDEX, where VIEW is either MAIN_VIEW or SUB_VIEW, and INDEX is the 0-based document index.

NPPM_GETSESSIONFILES = 2038

BOOL NPPM_GETSESSIONFILES (wchar_t** sessionFileArray, wchar_t* sessionFileName)
Get the full path names of all files listed in the session file with the given sessionFileName.

wParam (UIntPtr) [out]: sessionFileArray - pre-allocated array of file paths. To allocate the array with the proper size, first send NPPM_GETNBSESSIONFILES

lParam (IntPtr) [in]: sessionFileName - the XML session file's full path

Returns FALSE on failure, TRUE on success.

NPPM_GETSETTINGSONCLOUDPATH = 2122

int NPPM_GETSETTINGSONCLOUDPATH(size_t strLen, wchar_t* settingsOnCloudPath)
Get the user's cloud settings file path. Useful if plugins want to store settings in the cloud, provided a valid path is set.

wParam (UIntPtr) [in]: strLen - buffer length of settingsOnCloudPath

lParam (IntPtr) [out]: settingsOnCloudPath - the allocated file path buffer

Returns the number of UTF-16 characters copied/to copy. The return value is 0 if this path is not set, or if strLen is not enough to copy the path.

Users should first call this API with settingsOnCloudPath set to NULL to get the required number of UTF-16 characters (not including the terminating NULL character), allocate the settingsOnCloudPath buffer with the returns value + 1, then call it again to get the file path.

NPPM_GETSHORTCUTBYCMDID = 2100

BOOL NPPM_GETSHORTCUTBYCMDID(int cmdID, ShortcutKey* sk)
Get the shortcut mapped to the plugin command with the given cmdID.

wParam (UIntPtr) [in]: cmdID - plugin command ID

lParam (IntPtr) [out]: sk - pre-allocated pointer to a ShortcutKey

Returns TRUE if the shortcut has been enabled, otherwise FALSE.

Should only be called after the NPPN_READY notification has been sent.

NPPM_GETTABCOLORID = 2138

int NPPM_GETTABCOLORID (int view, int tabIndex)
Get the color ID of the tab in the given view with the given tab index.

wParam (UIntPtr) [in]: view - 0 for MAIN_VIEW, 1 for SUB_VIEW, or -1 for the currently active view

lParam (IntPtr) [in]: tabIndex - 0-based tab index, i.e., 0 for the first tab, 1 for the second tab, etc., or -1 for the currently active tab

The return value is one of:
-1 (no color)
 0 (yellow)
 1 (green)
 2 (blue)
 3 (orange)
 4 (pink)
There is no matching "NPPM_SETTABCOLORID" API for setting the tab color. Plugins can instead use NPPM_MENUCOMMAND to set the active tab's color using the menu command IDs from IDM_VIEW_TAB_COLOUR_NONE to IDM_VIEW_TAB_COLOUR_5, i.e.:
IDM_VIEW_TAB_COLOUR_NONE (no color)
IDM_VIEW_TAB_COLOUR_1 (yellow)
IDM_VIEW_TAB_COLOUR_2 (green)
IDM_VIEW_TAB_COLOUR_3 (blue)
IDM_VIEW_TAB_COLOUR_4 (orange)
IDM_VIEW_TAB_COLOUR_5 (pink)

Added in 8.6.8

NPPM_GETWINDOWSVERSION = 2066

winVer NPPM_GETWINDOWSVERSION(0, 0)
Get the host PC's (Windows) OS version.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns a WinVer value.

NPPM_HIDEMENU = 2096

BOOL NPPM_HIDEMENU(0, BOOL hideOrNot)
Hide (or show) the menu bar.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: hideOrNot - if TRUE the menu bar will be hidden, otherwise it will be shown

Returns the old status value.

NPPM_HIDESTATUSBAR = 2098

BOOL NPPM_HIDESTATUSBAR(0, BOOL hideOrNot)
Hide (or show) the status bar.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: hideOrNot - if TRUE the status bar will be hidden, otherwise it will be shown

Returns the old status value.

NPPM_HIDETABBAR = 2075

BOOL NPPM_HIDETABBAR(0, BOOL hideOrNot)
Hide (or show) the tab bar.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: hideOrNot - if TRUE the tab bar will be hidden, otherwise it will be shown

Returns the old status value.

NPPM_HIDETOOLBAR = 2094

BOOL NPPM_HIDETOOLBAR(0, BOOL hideOrNot)
Hide (or show) the toolbar.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: hideOrNot - if TRUE the toolbar will be hidden, otherwise it will be shown

Returns the old status value.

NPPM_ISAUTOINDENTON = 2129

BOOL NPPM_ISAUTOINDENTON(0, 0)
Get the current state of the "Use Auto-Indentation" setting.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns TRUE if Auto-Indentation is on, FALSE otherwise.

Added in 8.3.3

NPPM_ISDARKMODEENABLED = 2131

BOOL NPPM_ISDARKMODEENABLED(0, 0)
Get the current status (ON or OFF) of the dark mode setting.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns TRUE if dark mode is enabled, otherwise FALSE.

Added in 8.4.1

NPPM_ISDOCSWITCHERSHOWN = 2110

BOOL NPPM_ISDOCLISTSHOWN(0, 0)
Get the visibility (hidden or visible) of the Document List panel.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns TRUE if the Document List panel is currently shown, FALSE otherwise.

NPPM_ISMENUHIDDEN = 2097

BOOL NPPM_ISMENUHIDDEN(0, 0)
Get the visibility (hidden or visible) of the menu bar.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns TRUE if the menu bar is hidden, otherwise FALSE.

NPPM_ISSTATUSBARHIDDEN = 2099

BOOL NPPM_ISSTATUSBARHIDDEN(0, 0)
Get the visibility (hidden or visible) of the status bar.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns TRUE if the status bar is hidden, otherwise FALSE.

NPPM_ISTABBARHIDDEN = 2076

BOOL NPPM_ISTABBARHIDDEN(0, 0)
Get the visibility (hidden or visible) of the tab bar.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns TRUE if the tab bar is hidden, otherwise FALSE.

NPPM_ISTOOLBARHIDDEN = 2095

BOOL NPPM_ISTOOLBARHIDDEN(0, 0)
Get the visibility (hidden or visible) of the toolbar.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns TRUE if the toolbar is hidden, otherwise FALSE.

NPPM_LAUNCHFINDINFILESDLG = 2053

BOOL NPPM_LAUNCHFINDINFILESDLG(wchar_t* dir2Search, wchar_t* filter)
Launch the "Find in Files" dialog and set the "Find in" directory and filters with the given arguments.

wParam (UIntPtr) [in]: dir2Search - if not NULL, this will be the working directory in which Notepad++ will search

lParam (IntPtr) [in]:filter - if not NULL, this filter string will be set in the filter field

Returns TRUE.

NPPM_LOADSESSION = 2058

BOOL NPPM_LOADSESSION(0, wchar_t* sessionFileName)
Reopen all the files listed in sessionFileName.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: sessionFileName - the full path name of the session file to reload

Returns TRUE.

NPPM_MAKECURRENTBUFFERDIRTY = 2068

BOOL NPPM_MAKECURRENTBUFFERDIRTY(0, 0)
Make the current document dirty, i.e., set the current buffer state to "modified".

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns TRUE.

NPPM_MENUCOMMAND = 2072

BOOL NPPM_MENUCOMMAND(0, int cmdID)
Run the Notepad++ command with the given command ID.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: cmdID - see MenuCmdId for all the Notepad++ menu command items

Returns TRUE.

NPPM_MODELESSDIALOG = 2036

HWND NPPM_MODELESSDIALOG(int action, HWND hDlg)
Register (or unregister) the plugin dialog with the given handle.

wParam (UIntPtr) [in]: action - either MODELESSDIALOGADD (to register) or MODELESSDIALOGREMOVE (to unregister)

lParam (IntPtr) [in]: hDlg - the handle of the dialog to register/unregister

For each dialog created by your plugin, you should use this API to register it (and unregister it on destruction). If this message is ignored, dialog edit controls will not receive key stroke messages such as TAB, Ctrl-C or Ctrl-V key.

NPPM_MSGTOPLUGIN = 2071

BOOL NPPM_MSGTOPLUGIN(wchar_t* destModuleName, communicationInfo *info)
Send a private message to the plugin with the given destModuleName. 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.

wParam (UIntPtr) [in]: destModuleName - the complete module file name of the destination plugin (including the ".dll" file extension)

lParam (IntPtr) [in]: communicationInfo - pointer to a CommunicationInfo structure

Returns TRUE if Notepad++ found the plugin by its module name (destModuleName) and passed the info (via communicationInfo), or FALSE if the destination plugin is not found.

NPPM_RELOADBUFFERID = 2085

BOOL NPPM_RELOADBUFFERID(UINT_PTR bufferID, BOOL alert)
Reload the document with the given buffer ID.

wParam (UIntPtr) [in]: bufferID - buffer ID of the document to reload

lParam (IntPtr) [in]: alert - TRUE to let the user confirm or reject the reload, or FALSE to reload with no alert

Returns TRUE on success, FALSE otherwise.

NPPM_RELOADFILE = 2060

BOOL NPPM_RELOADFILE(BOOL withAlert, wchar_t* filePathName2Reload)
Reload the document matching the given filePathName2Reload.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: filePathName2Reload - full file path of the document to reload

Returns TRUE if reloading succeeds, otherwise FALSE.

NPPM_REMOVESHORTCUTBYCMDID = 2120

BOOL NPPM_REMOVESHORTCUTBYCMDID(int pluginCmdID, 0)
Remove a shortcut that was mapped to the plugin command with the given ID.

wParam (UIntPtr) [in]: pluginCmdID - the ID of a plugin command

lParam (IntPtr): 0 (not used)

Returns TRUE if successful, otherwise FALSE.

NPPM_SAVEALLFILES = 2063

BOOL NPPM_SAVEALLFILES(0, 0)
Save all opened documents.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns FALSE when no file needs to be saved, else TRUE if at least one file is saved.

NPPM_SAVECURRENTFILE = 2062

BOOL NPPM_SAVECURRENTFILE(0, 0)
Save the currently active document.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr): 0 (not used)

Returns TRUE if the file is saved, otherwise FALSE (the file doesn't need to be saved, or another reason).

NPPM_SAVECURRENTFILEAS = 2102

BOOL NPPM_SAVECURRENTFILEAS (BOOL saveAsCopy, const wchar_t* filename)
Save the currently active document with the given filename and, optionally, save a copy under the current file name.

wParam (UIntPtr) [in]: saveAsCopy - FALSE to rename the current file, or TRUE to save a copy of it (like the "Save a Copy As..." action)

lParam (IntPtr) [in]: filename - full path name of the file to be saved

Returns TRUE if the operation is successful, otherwise FALSE.

NPPM_SAVECURRENTSESSION = 2040

wchar_t* NPPM_SAVECURRENTSESSION(0, wchar_t* sessionFileName)
Save all files currently open in Notepad++ to an XML session file.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: sessionFileName - the XML session file's full path

Returns a pointer to the sessionFileName buffer on success, NULL otherwise.

NPPM_SAVEFILE = 2118

BOOL NPPM_SAVEFILE(0, const wchar_t* fileNameToSave)
Save the (currently open) file with the given fileNameToSave.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: fileNameToSave - the full path of the file to be saved

Returns TRUE on success, FALSE if fileNameToSave is not found.

NPPM_SAVESESSION = 2039

wchar_t* NPPM_SAVESESSION(0, sessionInfo* si)
Save a given set of file paths to a new session file.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: si - a pointer to a SessionInfo structure

Returns a pointer to the session file name buffer on success, NULL otherwise.

Unlike NPPM_SAVECURRENTSESSION, which saves the currently open files, this API can be used to add any file to a session.

NPPM_SETBUFFERENCODING = 2091

BOOL NPPM_SETBUFFERENCODING(UINT_PTR bufferID, int encoding)
Set the encoding of the document with the given buffer ID.

wParam (UIntPtr) [in]: bufferID - buffer ID of the document

lParam (IntPtr) [in]: encoding - one of the UniMode values returned by NPPM_GETBUFFERENCODING

Returns TRUE on success, FALSE otherwise.

Can only be called on new, unedited files.

NPPM_SETBUFFERFORMAT = 2093

BOOL NPPM_SETBUFFERFORMAT(UINT_PTR bufferID, int format)
Set the EOL format of the document with the given buffer ID.

wParam (UIntPtr) [in]: bufferID - buffer ID of the document

lParam (IntPtr) [in]: format - one of the EOL formats returned by NPPM_GETBUFFERFORMAT

Returns TRUE on success, FALSE otherwise.

NPPM_SETBUFFERLANGTYPE = 2089

BOOL NPPM_SETBUFFERLANGTYPE(UINT_PTR bufferID, int langType)
Set the LangType associated with the current document matching the given buffer ID.

wParam (UIntPtr) [in]: bufferID - buffer ID of the document

lParam (IntPtr) [in]: langType - a LangType value

Returns TRUE on success, FALSE otherwise.

The langType parameter cannot be L_USER or L_EXTERNAL.

NPPM_SETCURRENTLANGTYPE = 2030

BOOL NPPM_SETCURRENTLANGTYPE(0, int langType)
Set the LangType associated with the current document.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: langType - see LangType for all valid values

Returns TRUE.

NPPM_SETEDITORBORDEREDGE = 2117

BOOL NPPM_SETEDITORBORDEREDGE(0, BOOL withEditorBorderEdgeOrNot)
Add or remove an additional sunken edge style to the Scintilla window.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: withEditorBorderEdgeOrNot - TRUE to add a border edge to the Scintilla window, FALSE to remove it

Returns TRUE.

NPPM_SETEXTERNALLEXERAUTOINDENTMODE = 2128

BOOL NPPM_SETEXTERNALLEXERAUTOINDENTMODE(const wchar_t* languageName, ExternalLexerAutoIndentMode autoIndentMode)
Set the ExternalLexerAutoIndentMode of the external lexer identified by languageName.

wParam (UIntPtr) [in]: languageName - name of an external lexer provided by a plugin

lParam (IntPtr) [in]: autoIndentMode - one of the following values:

  • Standard (0) - Notepad++ will keep the same TAB indentation between lines
  • C_Like (1) - Notepad++ will perform a C-Language style indentation for the selected external language
  • Custom (2) - a plugin will be controlling auto-indentation for the current language

Returns TRUE on success, otherwise FALSE.

Added in 8.3.3

NPPM_SETLINENUMBERWIDTHMODE = 2123

BOOL NPPM_SETLINENUMBERWIDTHMODE(0, int widthMode)
Set the line number margin width mode to "dynamic" (LINENUMWIDTH_DYNAMIC) or "constant" (LINENUMWIDTH_CONSTANT).

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: widthMode - either LINENUMWIDTH_DYNAMIC or LINENUMWIDTH_CONSTANT

Returns TRUE if successful, otherwise FALSE.

Plugins should disable constant width mode to ensure a smoother visual effect during vertical content scrolling.

NPPM_SETMENUITEMCHECK = 2064

BOOL NPPM_SETMENUITEMCHECK(UINT pluginCmdID, BOOL doCheck)
Set or remove the checkmark on a plugin menu item and highlight or unhighlight its toolbar icon (if any).

wParam (UIntPtr) [in]: pluginCmdID - the plugin command ID corresponding to the menu item; see CmdID

lParam (IntPtr) [in]: doCheck - TRUE to check the item, or FALSE to uncheck it

Returns TRUE.

NPPM_SETSMOOTHFONT = 2116

BOOL NPPM_SETSMOOTHFONT(0, BOOL setSmoothFontOrNot)
Enable or disable "smooth fonts" (i.e., ClearType Antialiasing). This API simply sends the SCI_SETFONTQUALITY message to Scintilla with an equivalent font quality setting.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: setSmoothFontOrNot - TRUE to send SCI_SETFONTQUALITY with SC_EFF_QUALITY_LCD_OPTIMIZED, or FALSE to send it with SC_EFF_QUALITY_DEFAULT

Returns TRUE.

NPPM_SETSTATUSBAR = 2048

BOOL NPPM_SETSTATUSBAR(int whichPart, wchar_t* str2set)
Change the text in a field of the status bar.

wParam (UIntPtr) [in]: whichPart - a value between STATUSBAR_DOC_TYPE - STATUSBAR_TYPING_MODE indicating the status bar section to set

lParam (IntPtr) [in]: str2set - the string to be shown in the given status bar section

Returns FALSE on failure, TRUE on success.

NPPM_SETUNTITLEDNAME = 2139

BOOL NPPM_SETUNTITLEDNAME(BufferID id, const wchar_t* newName)
Set the name of the untitled tab with the given buffer ID.

wParam (UIntPtr) [in]: id - buffer ID of the untitled tab

lParam (IntPtr) [in]: newName - the desired new name of the tab

Returns TRUE on success, FALSE otherwise.

Added in 8.6.9

NPPM_SHOWDOCLIST = 2109

BOOL NPPM_SHOWDOCLIST(0, BOOL toShowOrNot)
Show or hide the Document List panel.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: toShowOrNot - if TRUE, the Document List panel is shown, otherwise it is hidden

Returns TRUE.

NPPM_SWITCHTOFILE = 2061

BOOL NPPM_SWITCHTOFILE(0, wchar_t* filePathName2switch)
Switch to the document matching the given filePathName2switch.

wParam (UIntPtr): 0 (not used)

lParam (IntPtr) [in]: filePathName2switch - the full file path of document to switch to

Returns TRUE.

NPPM_TRIGGERTABBARCONTEXTMENU = 2073

BOOL NPPM_TRIGGERTABBARCONTEXTMENU(int inView, int index2Activate)
Switch to the document in the given view with the given index2Activate, then open the context menu in it.

wParam (UIntPtr) [in]: inView - either MAIN_VIEW or SUB_VIEW

lParam (IntPtr) [in]: index2Activate - the index (in the given view) of the document where the context menu will be triggered

Returns TRUE.

NPPN_BEFORESHUTDOWN = 1019

To notify plugins that an application shutdown has been triggered; no files have been closed yet

scnNotification->nmhdr.code = NPPN_BEFORESHUTDOWN;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = 0;
NPPN_BUFFERACTIVATED = 1010

To notify plugins that a buffer has been activated (i.e., put into the foreground)

scnNotification->nmhdr.code = NPPN_BUFFERACTIVATED;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = activatedBufferID;
NPPN_CANCELSHUTDOWN = 1020

To notify plugins that an application shutdown has been cancelled

scnNotification->nmhdr.code = NPPN_CANCELSHUTDOWN;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = 0;
NPPN_CMDLINEPLUGINMSG = 1028

To notify plugins that the command line argument -pluginMessage="YOUR_PLUGIN_ARGUMENT" is available

scnNotification->nmhdr.code = NPPN_CMDLINEPLUGINMSG;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = pluginMessage; //where pluginMessage is pointer of type wchar_t

Added in 8.4.2

NPPN_DARKMODECHANGED = 1027

To notify plugins that dark mode was enabled/disabled

scnNotification->nmhdr.code = NPPN_DARKMODECHANGED;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = 0;

Added in 8.4.1

NPPN_DOCORDERCHANGED = 1017

To notify plugins that the document order has changed

scnNotification->nmhdr.code = NPPN_DOCORDERCHANGED;
scnNotification->nmhdr.hwndFrom = newIndex;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_EXTERNALLEXERBUFFER = 1029

To notify lexer plugins that the buffer (passed in idFrom) was just applied to an external lexer

scnNotification->nmhdr.code = NPPN_EXTERNALLEXERBUFFER;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = BufferID; //where pluginMessage is pointer of type wchar_t

Added in 8.5

NPPN_FILEBEFORECLOSE = 1003

To notify plugins that a file is about to be closed

scnNotification->nmhdr.code = NPPN_FILEBEFORECLOSE;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_FILEBEFOREDELETE = 1024

To notify plugins that a file is about to be deleted

scnNotification->nmhdr.code = NPPN_FILEBEFOREDELETE;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_FILEBEFORELOAD = 1014

To notify plugins that a file is about to be loaded

scnNotification->nmhdr.code = NPPN_FILEBEFOREOPEN;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = NULL;
NPPN_FILEBEFOREOPEN = 1006

To notify plugins that a file is about to be opened

scnNotification->nmhdr.code = NPPN_FILEBEFOREOPEN;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_FILEBEFORERENAME = 1021

To notify plugins that a file is about to be renamed

scnNotification->nmhdr.code = NPPN_FILEBEFORERENAME;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_FILEBEFORESAVE = 1007

To notify plugins that the current file is about to be saved

scnNotification->nmhdr.code = NPPN_FILEBEFOREOPEN;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_FILECLOSED = 1005

To notify plugins that a file was just closed

scnNotification->nmhdr.code = NPPN_FILECLOSED;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_FILEDELETED = 1026

To notify plugins that a file has been deleted

scnNotification->nmhdr.code = NPPN_FILEDELETED;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_FILEDELETEFAILED = 1025

To notify plugins that a file deletion has failed

scnNotification->nmhdr.code = NPPN_FILEDELETEFAILED;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_FILELOADFAILED = 1015

To notify plugins that a file-open operation failed

scnNotification->nmhdr.code = NPPN_FILEOPENFAILED;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_FILEOPENED = 1004

To notify plugins that a file was just opened

scnNotification->nmhdr.code = NPPN_FILEOPENED;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_FILERENAMECANCEL = 1022

To notify plugins that a file rename has been cancelled

scnNotification->nmhdr.code = NPPN_FILERENAMECANCEL;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_FILERENAMED = 1023

To notify plugins that a file has been renamed

scnNotification->nmhdr.code = NPPN_FILERENAMED;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_FILESAVED = 1008

To notify plugins that the current file was just saved

scnNotification->nmhdr.code = NPPN_FILESAVED;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_FIRST = 1000

Notification code.

NPPN_GLOBALMODIFIED = 1030

To notify plugins that the current document was just modified by the "Replace All" action.

To solve a performance issue, since v8.6.4 Notepad++ doesn't trigger SCN_MODIFIED during the "Replace All" action anymore.

As a result, plugins that monitor SCN_MODIFIED should also monitor NPPN_GLOBALMODIFIED.

scnNotification->nmhdr.code = NPPN_GLOBALMODIFIED;
scnNotification->nmhdr.hwndFrom = BufferID;
scnNotification->nmhdr.idFrom = 0; // preserved for the future use, must be zero

Added in 8.6.5

NPPN_LANGCHANGED = 1011

To notify plugins that the programming language of the current document was just changed

scnNotification->nmhdr.code = NPPN_LANGCHANGED;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = currentBufferID;
NPPN_NATIVELANGCHANGED = 1031

To notify plugins that the current native language is just changed to another one.

Use NPPM_GETNATIVELANGFILENAME to get the current native language file name.

Use NPPM_GETMENUHANDLE(NPPPLUGINMENU, 0) to get the "Plugins" submenu handle (IntPtr).

scnNotification->nmhdr.code = NPPN_NATIVELANGCHANGED;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = 0; // preserved for the future use, must be zero

Added in 8.7

NPPN_READONLYCHANGED = 1016

To notify plugins that the readonly status of the current document has changed

scnNotification->nmhdr.code = NPPN_READONLYCHANGED;
scnNotification->nmhdr.hwndFrom = bufferID;
scnNotification->nmhdr.idFrom = docStatus;

where:

NPPN_READY = 1001

To notify plugins that all of Notepad++'s initialization routines are complete

scnNotification->nmhdr.code = NPPN_READY;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = 0;
NPPN_SHORTCUTREMAPPED = 1013

To notify plugins that a plugin command shortcut was remapped

scnNotification->nmhdr.code = NPPN_SHORTCUTSREMAPPED;
scnNotification->nmhdr.hwndFrom = ShortcutKeyStructurePointer;
scnNotification->nmhdr.idFrom = cmdID;

where ShortcutKeyStructurePointer is a pointer to a C-compatible ShortcutKey structure:

struct ShortcutKey {
		bool _isCtrl;
		bool _isAlt;
		bool _isShift;
		UCHAR _key;
};
NPPN_SHUTDOWN = 1009

To notify plugins that Notepad++ is about to shut down

scnNotification->nmhdr.code = NPPN_SHUTDOWN;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = 0;
NPPN_SNAPSHOTDIRTYFILELOADED = 1018

To notify plugins that a dirty file snapshot was loaded on startup

scnNotification->nmhdr.code = NPPN_SNAPSHOTDIRTYFILELOADED;
scnNotification->nmhdr.hwndFrom = NULL;
scnNotification->nmhdr.idFrom = BufferID;
NPPN_TBMODIFICATION = 1002

To notify plugins that toolbar icons can be registered

scnNotification->nmhdr.code = NPPN_TB_MODIFICATION;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = 0;
NPPN_WORDSTYLESUPDATED = 1012

To notify plugins that the user has made a change in the "Style Configurator" dialog

scnNotification->nmhdr.code = NPPN_WORDSTYLESUPDATED;
scnNotification->nmhdr.hwndFrom = hwndNpp;
scnNotification->nmhdr.idFrom = currentBufferID;
NPPPLUGINMENU = 0

See NPPM_GETMENUHANDLE

NPP_DIRECTORY = 7
NPP_FULL_FILE_PATH = 10
PRIMARY_VIEW = 1

See NPPM_GETNBOPENFILES

RUNCOMMAND_USER = 4024
SECOND_VIEW = 2

See NPPM_GETNBOPENFILES

STATUSBAR_CUR_POS = 2
STATUSBAR_DOC_SIZE = 1
STATUSBAR_DOC_TYPE = 0
STATUSBAR_EOF_FORMAT = 3
STATUSBAR_TYPING_MODE = 5
STATUSBAR_UNICODE_TYPE = 4
SUB_VIEW = 1
VAR_NOT_RECOGNIZED = 0