Notepad++ 插件 开发

本文介绍如何为Notepad++开发插件,包括设置插件名称、定义命令数量及名称、实现相应功能等步骤,并提供开发流程及参考资料。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<style> <!-- @font-face {font-family:宋体} @font-face {font-family:"\@宋体"} p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Times New Roman"} h4 {margin-right:0cm; margin-left:0cm; font-size:12.0pt; font-family:宋体; font-weight:bold} a:link, span.MsoHyperlink {color:blue; text-decoration:underline} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline} p {margin-right:0cm; margin-left:0cm; font-size:12.0pt; font-family:宋体} tt {font-family:宋体} @page Section1 {margin:72.0pt 90.0pt 72.0pt 90.0pt; layout-grid:15.6pt} ol {margin-bottom:0cm} ul {margin-bottom:0cm} --> </style> <style> <!-- table.MsoNormalTable {font-size:10.0pt; font-family:"Times New Roman"} --> </style>

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

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) {

return PLUGIN_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.优快云 转载请注明出处
/*

执行顺序:

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值