I am going to create my own plugin for notepad++. It is necessary to use a console in my plugin but I don't want create another one because there is one in the NppExec plugin. So my question is can I use NppExec console from my own plugin ?
Asked
Active
Viewed 518 times
1 Answers
0
I got an answer from NppExec forum https://sourceforge.net/projects/npp-plugins/forums/forum/672146/topic/5287950
Edited Pasting from the link above:
Of course! You can look at NppExecPluginMsgTester inside NppExec's sources and use its code partly or entirely. The NppExecPluginMsgTester uses a "wrapper" of messages declared inside "NppExec\src\PluginCommunication\nppexec_msgs.h".
Here an example the NppExec source code:
#define NPEM_PRINT 0x0401 // message
/*
Prints (shows) given text in NppExec's Console window.
You can separate text lines using _T('\n') or _T("\r\n").
This text can be highlighted if NppExec's Console Highlight Filters are used.
If plugin's state is "busy", this message is ignored.
Example:
const TCHAR* cszMyPlugin = _T("my_plugin");
DWORD dwState = 0;
CommunicationInfo ci = { NPEM_GETSTATE,
cszMyPlugin,
(void *) &dwState };
::SendMessage( hNppWnd, NPPM_MSGTOPLUGIN,
(WPARAM) _T("NppExec.dll"), (LPARAM) &ci );
if ( dwState == NPE_STATEREADY )
{
// the plugin is "ready"
const TCHAR* szText = _T("Hello from my plugin!\n(test message)")
CommunicationInfo ci = { NPEM_PRINT,
cszMyPlugin,
(void *) szText };
::SendMessage( hNppWnd, NPPM_MSGTOPLUGIN,
(WPARAM) _T("NppExec.dll"), (LPARAM) &ci );
}
*/

Assad Ebrahim
- 6,234
- 8
- 42
- 68

Eugene Gluhotorenko
- 3,094
- 2
- 33
- 52
-
Liked the question. So what's the answer? Just plonking down code doesn't help very much. – Assad Ebrahim Aug 21 '12 at 21:28