Notepad++ plugin(插件)开发之消息HOOK (文件保存,文件打开,文件关闭)
来源:互联网 发布:linux如何关闭防火墙 编辑:程序博客网 时间:2024/05/16 06:16
Notepad++ plugin(插件)开发之消息HOOK (文件保存,文件打开,文件关闭)
Notepad++ 插件 开发(上一篇关于 notepad++ plugin(插件开发)的文章)
(找了比较久才发现,记录一下 IS2120#CSDN )http://blog.csdn.net/is2120/article/details/7190482
1. 在notepad++提供了一些hook消息,能够 用于通知plugin一些消息,诸如
文件的打开,文件的保存等
2. 如何利用这些消息(使用c++开发)
在开发plugin时会有一些必须的函数。其中之一是
typedef void (__cdecl * PBENOTIFIED)(SCNotification *);
void __cdeclbeNotified(struct SCNotification *notifyCode);
这个函数在编辑文件的时候总是会被调用。
http://blog.csdn.net/is2120/article/details/7190482
可以在这个函数里获取这些通知消息,完成自己想做的事情。
http://blog.csdn.net/is2120/article/details/7190482在开发plugin时会有一些必须的函数。其中之一是
typedef void (__cdecl * PBENOTIFIED)(SCNotification *);
void __cdeclbeNotified(struct SCNotification *notifyCode);
这个函数在编辑文件的时候总是会被调用。
http://blog.csdn.net/is2120/article/details/7190482
可以在这个函数里获取这些通知消息,完成自己想做的事情。
//z 2012-6-6 10:25:22 AM is2120@csdn
3. 文件的打开 (NPPN_FILEOPENED)
这个消息只能提示你一个文件打开了,但是不能告知你文件是否载入好了。
可以通过使用 NPPN_BUFFERACTIVATED 来提示文件文件已经载入,但是这个与FILEOPENED并不一样。
NPPN_FILEOPENED sends a BufferID which a plugin shouldtransparently use to retrieve information about a file, but not its contents.
详细信息如下:
// Notification code
#define NPPN_FIRST 1000
#define NPPN_READY (NPPN_FIRST + 1) // To notify plugins that all the procedures of launchment of notepad++ are done.
//scnNotification->nmhdr.code = NPPN_READY;
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = 0;
#define NPPN_TBMODIFICATION (NPPN_FIRST + 2) // To notify plugins that toolbar icons can be registered
//scnNotification->nmhdr.code = NPPN_TB_MODIFICATION;
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = 0;
#define NPPN_FILEBEFORECLOSE (NPPN_FIRST + 3) // To notify plugins that the current file is about to be closed
//scnNotification->nmhdr.code = NPPN_FILEBEFORECLOSE;
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = BufferID;
#define NPPN_FILEOPENED (NPPN_FIRST + 4) // To notify plugins that the current file is just opened
//scnNotification->nmhdr.code = NPPN_FILEOPENED;
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = BufferID;
#define NPPN_FILECLOSED (NPPN_FIRST + 5) // To notify plugins that the current file is just closed
//scnNotification->nmhdr.code = NPPN_FILECLOSED;
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = BufferID;
#define NPPN_FILEBEFOREOPEN (NPPN_FIRST + 6) // To notify plugins that the current file is about to be opened
//scnNotification->nmhdr.code = NPPN_FILEBEFOREOPEN;
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = BufferID;
#define NPPN_FILEBEFORESAVE (NPPN_FIRST + 7) // 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;
#define NPPN_FILESAVED (NPPN_FIRST + 8) // To notify plugins that the current file is just saved
//scnNotification->nmhdr.code = NPPN_FILESAVED;
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = BufferID;
#define NPPN_SHUTDOWN (NPPN_FIRST + 9) // To notify plugins that Notepad++ is about to be shutdowned.
//scnNotification->nmhdr.code = NPPN_SHUTDOWN;
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = 0;
#define NPPN_BUFFERACTIVATED (NPPN_FIRST + 10) // To notify plugins that a buffer was activated (put to foreground).
//scnNotification->nmhdr.code = NPPN_BUFFERACTIVATED;
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = activatedBufferID;
#define NPPN_LANGCHANGED (NPPN_FIRST + 11) // To notify plugins that the language in the current doc is just changed.
//scnNotification->nmhdr.code = NPPN_LANGCHANGED;
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = currentBufferID;
#define NPPN_WORDSTYLESUPDATED (NPPN_FIRST + 12) // To notify plugins that user initiated a WordStyleDlg change.
//scnNotification->nmhdr.code = NPPN_WORDSTYLESUPDATED;
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = currentBufferID;
#define NPPN_SHORTCUTREMAPPED (NPPN_FIRST + 13) // To notify plugins that plugin command shortcut is remapped.
//scnNotification->nmhdr.code = NPPN_SHORTCUTSREMAPPED;
//scnNotification->nmhdr.hwndFrom = ShortcutKeyStructurePointer;
//scnNotification->nmhdr.idFrom = cmdID;
//where ShortcutKeyStructurePointer is pointer of struct ShortcutKey:
//struct ShortcutKey {
// bool _isCtrl;
// bool _isAlt;
// bool _isShift;
// UCHAR _key;
//};
#define NPPN_FILEBEFORELOAD (NPPN_FIRST + 14) // To notify plugins that the current file is about to be loaded
//scnNotification->nmhdr.code = NPPN_FILEBEFOREOPEN;
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = NULL;
#define NPPN_FILELOADFAILED (NPPN_FIRST + 15) // To notify plugins that file open operation failed
//scnNotification->nmhdr.code = NPPN_FILEOPENFAILED;
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = BufferID;
#define NPPN_READONLYCHANGED (NPPN_FIRST + 16) // To notify plugins that current document change the readonly status,
//scnNotification->nmhdr.code = NPPN_READONLYCHANGED;
//scnNotification->nmhdr.hwndFrom = bufferID;
//scnNotification->nmhdr.idFrom = docStatus;
// where bufferID is BufferID
// docStatus can be combined by DOCSTAUS_READONLY and DOCSTAUS_BUFFERDIRTY
#define DOCSTAUS_READONLY 1
#define DOCSTAUS_BUFFERDIRTY 2
#define NPPN_DOCORDERCHANGED (NPPN_FIRST + 16) // To notify plugins that document order is changed
//scnNotification->nmhdr.code = NPPN_DOCORDERCHANGED;
//scnNotification->nmhdr.hwndFrom = newIndex;
//scnNotification->nmhdr.idFrom = BufferID;
#endif
/z 2012-1-10 11:21 AM IS2120@CSDN
- Notepad++ plugin(插件)开发之消息HOOK (文件保存,文件打开,文件关闭)
- QT-notepad 打开/保存文件
- Java基础学习之io流的练习(NotePad的打开文件和保存文件)
- Sublime Plugin - 实现类似Notepad复制文件到分屏的插件
- vi & vim 打开、关闭、保存文件
- vi & vim 打开 关闭 保存 文件
- vi & vim 打开 关闭 保存 文件
- Notepad++ 启动时不打开最近关闭的文件
- 设置NotePad++不打开上次关闭的文件
- 【HTML】设置NotePad++不打开上次关闭的文件
- 设置NotePad++设置"不打开上次关闭的文件"
- Notepad++插件安装和使用和打开大文件
- 打开文件关闭文件函数
- 保存文件打开文件对话框
- Qt打开文件保存文件
- 练习 打开文件&保存文件
- Notepad++不打开最近打开的文件
- Notepad++ -- 不打开上次打开的文件
- 态度成就你们人生
- 使用Jackson解析json配合Hibernate报错的解决方法
- Linux多线程编程(转载于吴秦前辈)
- 迪拜酒店内豹纹鲨连续四年单性繁殖
- gdb常用命令abc
- Notepad++ plugin(插件)开发之消息HOOK (文件保存,文件打开,文件关闭)
- USACO Section 4.1 Cryptcowgraphy - BT的DFS剪枝..
- word应用:Word2007表格中快速填充编号序列
- Types of permissions (MDB) zz
- 常用的HTML标签和属性解释
- php中foreach()函数的用法
- unable to open “frameworks\locale\zh_CN’ 解决方法
- 技嘉X79 UD3主板再创Intel reg X79超频世界纪录
- 黑马-----银行业务调度系统