【问题标题】:Re-using NppExec's console in developing a separate plugin for Notepad++ -- can it be done?重新使用 NppExec 的控制台为 Notepad++ 开发一个单独的插件——可以吗?
【发布时间】:2012-05-19 17:48:32
【问题描述】:

我要为记事本++ 创建自己的插件。有必要在我的插件中使用控制台,但我不想创建另一个控制台,因为 NppExec 插件中有一个。所以我的问题是我可以从我自己的插件中使用 NppExec 控制台吗?

【问题讨论】:

    标签: plugins notepad++ nppexec


    【解决方案1】:

    我从 NppExec 论坛https://sourceforge.net/projects/npp-plugins/forums/forum/672146/topic/5287950得到了答复

    已编辑 从上面的链接粘贴:

    当然!您可以查看 NppExec 内部的 NppExecPluginMsgTester 来源并部分或全部使用其代码。这 NppExecPluginMsgTester 使用内部声明的消息“包装器” "NppExec\src\PluginCommunication\nppexec_msgs.h"。

    这里以 NppExec 源代码为例:

    #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 );
      }
      */
    

    【讨论】:

    • 喜欢这个问题。那么答案是什么?只是把代码写下来并没有多大帮助。
    猜你喜欢
    • 2018-05-18
    • 1970-01-01
    • 2012-03-29
    • 2022-01-20
    • 1970-01-01
    • 2012-08-23
    • 2020-02-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多