Menu

How to write a plugin?

2007-08-20
2012-11-14
  • Kristian Zarse

    Kristian Zarse - 2007-08-20

    Hi,

    I have probably overlooked the according thread(s) ... is there any "How To" page or documentation which briefly describes hiw you can write N++ plugins? I mean, there must at least be a kind of interface spec or something.

    And is it possible to use VB to create a plugin DLL? Shouldn´t be an issue, is it?

    Thanks for any helpful links / infos in advance - I don´t plan to blow this thread with "thank you" postings for every single answer ;)

    Best regards,
    Kristian

     
    • Nobody/Anonymous

      I wrote the Delphi plug-in template.  Here's an example of a plug-in

      This hides all unmarked lines.  All you do is add this to the template in place of the existing MyProc1.  The code is more or less identical to the C examples that are given on the Notepad++ website.  You'll need the Scintilla documentation, specifically scintilla.iface.  This tells you what the SCI_xx commands do.

      procedure MyProc1; cdecl;
      var
         currentEdit : integer;
         LineCount : integer;
         LineNo : integer;
         Mask : integer;
         LastMarker : integer;
      begin
         SendMessage(LocalNppData._nppHandle, WM_GETCURRENTSCINTILLA, 0, integer(@currentEdit));
         LineCount := SendMessage(getCurrentHScintilla(currentEdit), SCI_GetLineCount, 0, 0);
         LastMarker := 0;
         for LineNo := 0 to LineCount - 1 do begin
            Mask:= SendMessage(getCurrentHScintilla(currentEdit), SCI_MarkerGet, LineNo, 0);
            if Mask <> 0 then begin
               if LastMarker <= LineNo-1 then begin
                  SendMessage(getCurrentHScintilla(currentEdit), SCI_HideLines, LastMarker, LineNo-1);
               end;
               LastMarker := LineNo+1;        // Start hiding from LineNo+1
            end;
         end;
         //
         // Hide from the last marked line up to the end (providing there's something to hide)
         //
         if LastMarker <= LineCount-1 then begin
            SendMessage(getCurrentHScintilla(currentEdit), SCI_HideLines, LastMarker, LineCount-1);
         end;
      end;

       
    • Marek_Pi_1

      Marek_Pi_1 - 2007-08-23

      Hi,
      I want to create a plugin for Notepad++. I made a DLL acc. "NppInsertPlugin" and "PluginDemo" I found on the net. I compiled it in Borland C++ Builder. When I copy dhe library into plugin directory of N++ and start N++, the application fails down (ver. 4.1.2 and 4.2.2 of N++), or there is a warning "The specified procedure could not be found" and N++ is not running (ver. 3.9, fails without debug window).

      Seems to be a problem with compatibility (different format). I would like not to use MS VC++ compiler.

      I tried to compile "NppInsertPlugin" with MinGW but the compilation failed.

      Could anybody points the source that can be used for Borland Builder or other compilers (except VC++) with correct makefile or batch file (it can do "nothing special", I would like to verify that anything is possible with Borland, gcc, ...).
      Or information how to check my DLL (from external program I can run e.g. "getName" function, also compiled with Borland Builder).

      I had also function: "messageProc".

      My e-mail addr: mpm1@sourceforge.net

      Marek

       
    • Marek_Pi_1

      Marek_Pi_1 - 2007-08-23

      Sorry:
      The e-mail address isr: mpm1@users.sourceforge.net
      Marek

       
    • ccigi

      ccigi - 2007-08-20

      Hello Kristian,

      I asked a similar question here: https://sourceforge.net/forum/forum.php?thread_id=1798333&forum_id=482781.  I haven't received an answer yet, but I found a plugin HOWTO here: http://notepad-plus.sourceforge.net/uk/plugins-HOWTO.php.  I have been programming in C++ for quite a while, but I've never written a DLL and wanted to create a Notepad++ plugin to help me learn to write DLLs.  It looks like I will just have to learn the ins and outs of Notepad++ before I am able to do that.  It would be nice if there was better documentation for the plugin framework.

      ccigi

       
    • Nobody/Anonymous

      And is it possible to use Delphi to create a plugin DLL? there is a template, yet there is no how to documentation

       
      • Damjan Cvetko

        Damjan Cvetko - 2007-08-21

        One plugin that is available on the "notepad++ plugins" project is written completely in Delphi. DBGP plugin. I wanted to create a 'framework' for npp plugins in delphi, but... The code is somewhat specific to what I need and the base classes culd use a few more functions (epecially I'd need to replace RAW WM call with neat functions...)

        Drop me a mail if you need any help...

        To others of you, best howto is the code q;)

        I'm sute VB should not be a problem after somebody does the low-level work.