zoukankan      html  css  js  c++  java
  • Notepad++ 插件 开发

    notepad++ plugin development
    //z 2011-09-18 21:09:44@is2120.CSDN 转载请注明出处
    //z 2012-07-06 10:20:05 AM is2120@csdn.T3826204531
    //z 因想修改一个插入日期的插件稍微看了一下,做了点笔记。可以看英文的直接看英文去哈。。。

    切记:一定要预先选定一种适当的字符编码(unicode或者ansi),要不然很痛苦。。。

    1.
    下载 Notepad++Plugin Template
    2.
    vs中打开NppPluginTemplate.vcproj
    3. PluginDefinition.h中定义插件名称
    #define PLUGIN_NAMEL"InsertDate"

    // The getName function tells Notepad++ plugins system its name

    constTCHAR *__cdeclgetName(void) {

          returnPLUGIN_NAME;

    }

    4.
    PluginDefinition.h中定义插件命令数目
    // The getFuncsArray function gives Notepad++ plugins system the pointerFuncItem Array

    // and the size of this array (the number of functions)

    struct FuncItem *__cdeclgetFuncsArray(int *nbF) {

          *nbF =NELEM(funcItem);

    returnfuncItem;
    }

    // The setInfo function gets the needed infos fromNotepad++ plugins system

    void__cdeclsetInfo(structNppDatanotpadPlusData) {

          nppData =notpadPlusData;

    }

    5.
    PluginDefinition.cpp中定制命令名称和相关函数名称
    struct FuncItem funcItem[]={

          {L"CurrentFull Path",pfinsertCurrentFullPath,0,FALSE},

          {L"CurrentFile Name",pfinsertCurrentFileName,0,FALSE},

          {L"CurrentDirectory",pfinsertCurrentDirectory,0,FALSE},

          {L"Date&& Time - short format",pfinsertShortDateTime,0,FALSE},

          {L"Date&& Time - long format",pfinsertLongDateTime,0,FALSE},

          {L"CloseHTML/XML tag automatically",pfinsertHtmlCloseTag,0,FALSE},

          {L"About",pfabout,0,FALSE},

    };

    6.
    定义相关函数

    PluginDefinition.h andPluginDefinition.cpp中有如下这些注释指引着你:
    //-- STEP 1. DEFINE YOUR PLUGIN NAME --// 定义你的插件名

    //-- STEP 2. DEFINE YOUR PLUGIN COMMAND NUMBER --// 定义你的插件命令

    //-- STEP 3. CUSTOMIZE YOUR PLUGIN COMMANDS --// 定制你的插件命令

    //-- STEP 4. DEFINE YOUR ASSOCIATED FUNCTIONS --// 实现相关函数

    //z 2011-09-18 21:09:44@is2120.CSDN 转载请注明出处
    /*

    执行顺序:

    1. Notepad++调用DllMain()载入插件

    2. N++调用getFuncsArray,SetInfo,getName得到初始的操作信息

    3.当编辑的时候beNotified不断被调用

    */

     //z 上述只供自己备忘;详细请见以下资料:
    http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Plugin_Development_Quick_Start_Guide
    http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Plugin_Development#How_to_develop_a_plugin

    Notepad++ plugin(插件)开发之消息HOOK (文件保存,文件打开,文件关闭)
    //z 2012-07-06 10:20:05 AM is2120@csdn.T3826204531

    Mod版本的TaskList

  • 相关阅读:
    20172313 2018-2019-1 《程序设计与数据结构》第七周学习总结
    20172313 2018-2019-1 《程序设计与数据结构》第六周学习总结
    20172313 2018-2019-1 《程序设计与数据结构》课堂测试修改报告
    20172313 2018-2019-1 《程序设计与数据结构》第五周学习总结
    2019_软工实践_个人总结
    2019_软工实践_Beta收官
    2019_软工实践_Beta(5/5)
    2019_软工实践_Beta(4/5)
    2019_软工实践_Beta(3/5)
    2019_软工实践_Beta(2/5)
  • 原文地址:https://www.cnblogs.com/IS2120/p/6746007.html
Copyright © 2011-2022 走看看