New to plugin development - help needed.
-
I am an experienced developer and just need a few hints and some documentation.
I write most of my code in Java and use log4j to output log statements. I have a specific technique where the log statement has a “tag” like XYZ-ABC-001 where XYZ is the client name, ABC is an abbreviation of the module name, and the number is never repeated in the module. The number doesn’t have to be sequential but it does have to be unique.
I want to write a plugin similar to the compare plugin where the left side window has the code and the right has the log file. I want to have the left side display the code whenever the user scrolls through the log lines, changing file if needed.So my journey starts like this:
I got started with the template and just created two dummy methods and created the DLL using Visual Studio. I put the file into a folder on the plugins folder but I don’t see that plugin show up in the plugins dropdown. That’s my first question, how to make it show up. Is there a trick to it? The help here talks about Plugins Manager but that’s gone it’s now Plugins Admin and there’s no button for uncertified plugin loading.
My other questions are around this: where’s the API documentation? I just need to know what to call to make what happen. I don’t see that anywhere and the demo plugin is very limited and cryptic.
I would welcome help here
-
@ksmith1787 said in New to plugin development - help needed.:
I put the file into a folder on the plugins folder
Some specifics (from you) would help here.
If your plugin is namedXXX.dll
, did you create a folder calledXXX
to put it in?
Thus, do you have:
...\plugins\XXX\XXX.dll
?
where’s the API documentation?
https://npp-user-manual.org/docs/plugin-communication/
and also you’ll need:
https://scintilla.org/ScintillaDoc.html
The help here talks about Plugins Manager but that’s gone it’s now Plugins Admin
Plugins Admin need not be your concern at the stage of development you’re at.
I just need to know what to call to make what happen
Well, there’s seeing the list of things to call, and then there’s knowing how it all plays together to make a working plugin.
I sense there will be more questions from you (and that’s fine). -
@ksmith1787 said in New to plugin development - help needed.:
I got started with the template and just created two dummy methods and created the DLL using Visual Studio. I put the file into a folder on the plugins folder but I don’t see that plugin show up in the plugins dropdown. That’s my first question, how to make it show up. Is there a trick to it?
Assuming that you have the DLL in a sub-folder of the plugins folder which has the same name as the DLL (without the .dll extension), the other bit is that you have to implement the functions from the template. DllMain, of course, but also setInfo (gives you the handles you’ll need to the Notepad++ window and the Scintilla controls); getName (lets you tell Notepad++ what name to put on the Plugins menu); getFuncsArray (lets you tell Notepad++ what entries to put on the sub-menu for your plugin); beNotified (lets you receive notifications from Notepad++ and Scintilla); messageProc (little-used, but should return TRUE); and isUnicode (must return TRUE).
If I recall correctly, if any of those are missing, Notepad++ doesn’t load the DLL at all. So even if you don’t use some of them, you must define them.
-
@Coises said in New to plugin development - help needed.:
the other bit is that you have to implement the functions from the template
The template (if we’re talking about THIS), as it is, provides everything needed for the plugin to “appear”.
So, unless OP has made a ton of changes to the template before building it and attempting to run it (and who would do that??), none of the items you referenced should be problems relating to the plugin showing up in the Plugins menu.But the things you referenced are good to note for when you really start changing the template to your specific need, i.e., consider carefully before deleting something that may look unneeded.
-
Well, I created a folder under plugins called SourceCorrelation and then the DLL file is called SourceCorrelationPlugin.dll. Based on your comment, I figured that the names have to be exactly the same. I changed the folder and now I am getting an error that the plugin is not compatible with my version of NPP. Mine is 7.8.8 (32 bit).
Not sure if I need to upgrade NPP to match the plugin or upgrade the plugin to match NPP. I will research that next.
I will bookmark those links. Thanks very much.
As far as the what, I am a pretty prolific developer, we’ll see how it goes.
-
@ksmith1787 said:
I created a folder under plugins called
SourceCorrelation
and then the DLL file is calledSourceCorrelationPlugin.dll
.Clearly that isn’t going to work.
For that to have a prayer of working, the folder should be namedSourceCorrelationPlugin
EDIT: Oops, I read further into your posting, and see that you’ve actually fixed that problem, but yes, it WAS a problem. -
@ksmith1787 said :
now I am getting an error that the plugin is not compatible with my version of NPP. Mine is 7.8.8 (32 bit).
Not sure if I need to upgrade NPP to match the plugin or upgrade the plugin to match NPP
So the plugin template should be good to go with 64-bit Notepad++ 8.6 (I’ve tested exactly that very recently).
Do yourself a favor (save headaches of uncertainty) and get yourself a portable release of that version.
Get your plugin up and running (basically) with that.
Then make other changes, such as switching it to 32-bit, and then trying with version 7.8.8 (if you have to stay with something as old as that).
Make small changes, test, make more changes, test, etc. (but you know this…being a “pretty prolific developer”). -
@Coises
Thanks much.I verified that these methods are defined in my SourceCorrelation.cpp file
-
Thanks again. I am developing this on an old laptop and didn’t realize NPP was so old. Upgraded using the drop-in (portable) version on x64 and all is working. Now to review the docs and plan my logic.
Keith Smith