I was wondering, are there any templates available to develop a plug-in in other languages, like Delphi, or .NET? If so, where could those be found? Or, if not, is there any kind of COM/ActiveX interface available?
I've got several ideas for plug-ins, and would like to write them, but I can't program in C(++). Delphi's the closest I can get, but my mastery of that language isn't good enough to convert the C++ samples provided on the site.
Otherwise, is there some kind of written tutorial explaining the requirements of a Notepad++ plug-in?
Thanks,
Martijn
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, I've started writing a plug-in using Delphi. I've translated the headers and that seems to be OK, but now I'm stuck:
* The DLL gets loaded. I initialize and populate my array of FuncItems.
* getFuncsArray is called. It returns a pointer to the first FuncItem element, and changes the int parameter to reflect the total number of FuncItems in the array.
* setInfo is called, passing along the Notepad++ and Scintilla handles. I make a copy of those.
* ...and, after returning from the setInfo call, Notepad++ crashes: I get a messagebox with a 'critical stop' icon, "System Err" in the title bar, and the message "De bewerking is voltooid." (I'm running a Dutch Windows XP version; I guess it's system message 0 -- 'the operation has been completed').
After clicking 'OK', Notepad++ is gone, without ever having become visible.
Since the error seems to occur in Notepad++, and not in my plug-in, I can't debug it.
Any idea what could be the cause of this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just posted a working example to this forum, but if it is any help, I had the same difficulty until I changed the procedure definitions from stdcall to cdecl. It all worked after that. Just in case, here's a trivial working example.
function getName:PChar; cdecl;
begin
ShowMessage('getName');
Result := 'My Test Plug-in';
end;
function getFuncsArray(var nFuncs:integer):Pointer;cdecl;
begin
ShowMessage('getFuncsArray');
nFuncs := 2;
Result := @FI;
end;
procedure beNotified; cdecl;
begin
end;
function messageProc(p1,p2:integer;p3:pointer): integer; cdecl;
begin
Result := 0;
end;
exports
setInfo,
getName,
getFuncsArray,
beNotified,
messageProc;
begin
{ First, assign the procedure to the DLLProc variable }
DllProc := @DLLEntryPoint;
{ Now invoke the procedure to reflect that the DLL is attaching to the
process }
DLLEntryPoint(DLL_PROCESS_ATTACH);
end.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for posting your solution! I'd dropped the thing since I couldn't get it to work quickly enough and didn't have more time back then. I'll try it out in the course of the next month(s); and see if I can get mine to work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can you send your .dll file to me so that I could test it with Notepad++ in debug mode? The sources of your plugin would be great also, if you don't mind to send them.
dvv81 (at) ukr (dot) net
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I was wondering, are there any templates available to develop a plug-in in other languages, like Delphi, or .NET? If so, where could those be found? Or, if not, is there any kind of COM/ActiveX interface available?
I've got several ideas for plug-ins, and would like to write them, but I can't program in C(++). Delphi's the closest I can get, but my mastery of that language isn't good enough to convert the C++ samples provided on the site.
Otherwise, is there some kind of written tutorial explaining the requirements of a Notepad++ plug-in?
Thanks,
Martijn
Unfortunatly no.
If there's any volunteer want to do it, he/she is very welcome.
Don
Well, I've started writing a plug-in using Delphi. I've translated the headers and that seems to be OK, but now I'm stuck:
* The DLL gets loaded. I initialize and populate my array of FuncItems.
* getFuncsArray is called. It returns a pointer to the first FuncItem element, and changes the int parameter to reflect the total number of FuncItems in the array.
* setInfo is called, passing along the Notepad++ and Scintilla handles. I make a copy of those.
* ...and, after returning from the setInfo call, Notepad++ crashes: I get a messagebox with a 'critical stop' icon, "System Err" in the title bar, and the message "De bewerking is voltooid." (I'm running a Dutch Windows XP version; I guess it's system message 0 -- 'the operation has been completed').
After clicking 'OK', Notepad++ is gone, without ever having become visible.
Since the error seems to occur in Notepad++, and not in my plug-in, I can't debug it.
Any idea what could be the cause of this?
I just posted a working example to this forum, but if it is any help, I had the same difficulty until I changed the procedure definitions from stdcall to cdecl. It all worked after that. Just in case, here's a trivial working example.
library DllEntry;
uses
SysUtils,
Windows,
Dialogs,
Classes;
type
NppData = record
_nppHandle : HWND;
_scintillaMainHandle : HWND;
_scintillaSecondHandle : HWND;
end;
TProc = procedure; cdecl;
FuncItem = record
_itemName:array[0..63] of char;
_pFunc : TProc;
_cmdID : integer;
_init2Check : integer;
_PShKey : pointer;
end;
var
LocalNppData : NppData;
FI : array[0..1] of FuncItem;
procedure MyProc; cdecl;
begin
ShowMessage('MyProc');
end;
procedure DLLEntryPoint(dwReason: DWord);
begin
case dwReason of
DLL_PROCESS_ATTACH:
begin
//ShowMessage('Attaching to process');
FillChar(FI[0],sizeof(FuncItem),0);
FI[0]._pFunc := MyProc;
strcopy(FI[0]._itemName,'MyProc');
FI[0]._init2Check := 0;
FI[0]._PShKey := nil;
FillChar(FI[1],sizeof(FuncItem),0);
FI[1]._pFunc := MyProc;
strcopy(FI[1]._itemName,'MyProc2');
FI[1]._init2Check := 1;
FI[1]._PShKey := nil;
end;
DLL_PROCESS_DETACH: begin end;
DLL_THREAD_ATTACH: MessageBeep(0);
DLL_THREAD_DETACH: MessageBeep(0);
end;
end;
procedure setInfo(NotePadPlusData : NppData);cdecl; // Needs struct nppdata
begin
ShowMessage('setInfo');
LocalNppData := NotePadPlusData;
end;
function getName:PChar; cdecl;
begin
ShowMessage('getName');
Result := 'My Test Plug-in';
end;
function getFuncsArray(var nFuncs:integer):Pointer;cdecl;
begin
ShowMessage('getFuncsArray');
nFuncs := 2;
Result := @FI;
end;
procedure beNotified; cdecl;
begin
end;
function messageProc(p1,p2:integer;p3:pointer): integer; cdecl;
begin
Result := 0;
end;
exports
setInfo,
getName,
getFuncsArray,
beNotified,
messageProc;
begin
{ First, assign the procedure to the DLLProc variable }
DllProc := @DLLEntryPoint;
{ Now invoke the procedure to reflect that the DLL is attaching to the
process }
DLLEntryPoint(DLL_PROCESS_ATTACH);
end.
Thanks for posting your solution! I'd dropped the thing since I couldn't get it to work quickly enough and didn't have more time back then. I'll try it out in the course of the next month(s); and see if I can get mine to work.
Can you send your .dll file to me so that I could test it with Notepad++ in debug mode? The sources of your plugin would be great also, if you don't mind to send them.
dvv81 (at) ukr (dot) net
Can you send your .dll file and the sources, if you don't mind to send them.
fnmi (at) mailcity (dot) com