[NEW Plugin] FirstUpper

  • I’m confused. I am trying to initialize a new scintillagateway and it seems the only way I can do this is by

    IntPtr scintilla = new IntPtr();
    ScintillaGateway currentScint = new ScintillaGateway(scintilla);

    Why is it necessary for me to create an IntPtr in order to create a new gateway?

    Also, you talk about not using StringBuilder objects and part of my code relies on the ability for the StringBuilder object to replace a single character with a new one. Strings cannot do this. In order to avoid using a StringBuilder, it seems I will have to use a character array or something similar.

    Do you know of a better way?


  • Regarding the IntPtr, forget what I said on that. I realized what I had to do after a little while…lol.

    IntPtr scintilla = PluginBase.GetCurrentScintilla();
    ScintillaGateway currentScint = new ScintillaGateway(scintilla);

    It’s working now that I’ve done that.

  • it is on purpose the gateway does not get the scintilla instance itself… . more complex pluginsmay choose to reuse the same instance, some look up the current scintilla all the time. The little experience I have I often do the later. Also notice that the PluginBase has a factory method you can use if you want to defer the instantiation to eg. specific keys are pressed.

    regarding the stringbuilder - please explain what you want to do. The ScintillaGateway operates solely on strings and does the encoding to/from Notepad++

  • yes you may need to use a stringbuilder for string manipulation - but getting text from notepad++ and setting text in notepad++ should not be done with a stringbuilder - although you can find plenty examples online that does this… but it does not work with non-US characters.

  • I’ve updated the plugin with Kasper Graversen’s .NET template and scintilla gateway.

    • New feature “Capitalize All Markdown Titles”. Supports Setext and Atx style headings.
    • Fixed the menu option descriptions so they more accurately describe what each option does.

    I have no way to test international characters so if anyone would like to test that for me, please do! If you test it and you have any ideas as to how to fix any problems with it, let me know!

    Thanks to Kasper for all of his help.

    Thank you for looking!

  • Hello zkirkland,

    Many thanks for this new plugin ! Unfortunately, once downloaded from :


    and the two files FirstUpper.dll andFirstUpperForbiddenWords.txt, installed in the plugins folder, of my N++ configuration, on restarting Notepad++, I got the message boxes :

    • The first, in French, which says, something like , below :

      The program or DLLC:_691\plugins\firstUpper.dll is not a valid windows image. Verify with the help of your installation media

    • The second N++ message, in English, says :

      %1 is not a valid Win32 application

      This program is not compatible with the current version of Notepad++

      Do you want to remove this plugin from plugins directory to prevent this message from the next launch time?

    Some hints, about these bug :

    • My operating system is ( still ! ) a Win XP SP3 configuration

    • My N++ configuration is a local configuration, with the 6.9.1 version of N++

    • Here is the result of the ? - The debug Info action :

      Notepad++ v6.9.1
      Build time : Mar 28 2016 - 19:48:40
      Path : C:_691\notepad++.exe
      Admin mode : OFF
      Local Conf mode : ON
      OS : Windows XP
      Plugins : DSpellCheck.dll mimeTools.dll NppConverter.dll NppExport.dll PluginManager.dll

    • As about the different .NET modules, installed on my system :

      • Microsoft .NET Compact Frawework 3.5

      • Microsoft .NET Framework 1.1

      • Microsoft .NET Framework 1.1 Hotfix ( KB928366 )

      • Microsoft .NET Framework 2.0 Service Pack 1

      • Microsoft .NET Framework 2.0 Secrive Pack 1 Language Pack - FRA

      • Microsoft .NET Framework 3.0 Service Pack 1

      • Microsoft .NET Framework 3.0 Secrive Pack 1 Language Pack - FRA

      • Microsoft .NET Framework 3.5

      • Microsoft .NET Framework 4 Client Profile

      • Microsoft User - Mode Driver Framework Feature Pack 1.0

      • Module linguistique Microsoft .NET Framework 3.5 - fra

    Any idea ?

    Best Regards,


  • The plugin framework requires dot net 3.5 but can easily be modified back to 2.0 by removing the factory method returning Func <> and changing the project to 2.0. It would be interesting to see if that is the root problem

  • @Kasper-Graversen: How and where do I remove that factory method returning Func<,>?

  • @guy038: I created a build (click me!) that uses .NET 2.0 and x86 architecture to see if that helps. Let me know if it works.


  • Hi zkirkland and Kasper,

    Thanks for having a glance about it ! Unfortunately, I get the same error windows, with your new FirstUpper.dll ( 43646 bytes ) and its associated text file FirstUpperForbiddenWords.txt :-((

    So, I think that we should have a logical attitude !

    • First, ask for people, having a Win XP configuration ( There are still some, indeed !! ) to test your plugin. May be, my Win XP system is just bugged !

    • As for me, tomorrow, I’ll verify, at work, your two versions of your plugin, both, on a Win XP and a W7 configuration, with local installation of the last 6.9.2 N++ version, without any additional plugin, but yours, of course !



  • @zkirkland seems you found the factory method :)

  • Hello zkirkland,

    Don’t understand what is happening ? Yesterday, I did try your plugin on an other Win XP machine as well as an W7 system. And as I’m, presently, building a W8.1 64b machine for a friend of mine, I just noticed that it did not work, too, on that W8.1 install !

    So, I suppose that I certainly, missed something important, but what ?! As you said, I just copy the DLL and the text file in the plugins folder of my local N++ configuration ?! So, what I’m doing wrong ?

    Best Regards,


  • @zkirkland maybe you messed around with the namespaces of the exports. If you try the demo app that comes with the pluginpack you can see the exported functions that N++ requires. Then you can check the ones for your plugin

    PS C:\src\NotepadPlusPlusPluginPack.Net\Demo Plugin\NppManagedPluginDemo\bin\Debug> & ‘C:\Program Files (x86)\Microsoft
    Visual Studio 14.0\VC\bin\dumpbin.exe’ -exports .\Demo.dll
    Microsoft ® COFF/PE Dumper Version 14.00.23918.0
    Copyright © Microsoft Corporation. All rights reserved.

    Dump of file .\Demo.dll

    File Type: DLL

    Section contains the following exports for \Demo.dll

    00000000 characteristics
    572B1CF6 time date stamp Thu May  5 12:14:14 2016
        0.00 version
           0 ordinal base
           6 number of functions
           6 number of names
    ordinal hint RVA      name
          5    0 0001691E beNotified
          2    1 000168EE getFuncsArray
          4    2 0001690E getName
          0    3 000168CE isUnicode
          3    4 000168FE messageProc
          1    5 000168DE setInfo

  • @guy038: I don’t know yet what is wrong. I am sorry. I am new to writing plugins for Notepad++. I will do my best to figure out what is going on.

    @Kasper-Graversen: I do not know how to interpret the output on your file nor do I understand how to use that on my own dll. However, you said perhaps I messed around with the namespaces. I did not change any namespaces.


  • @guy038: I compiled this on a W10 Pro 64 bit machine. I don’t know if that makes a difference but it may.

    @Kasper-Graversen: I figured it out and I ran the dumpbin.exe on my dll and got the same output you did.

    00000000 characteristics
    575EC538 time date stamp Mon Jun 13 09:37:44 2016
        0.00 version
           0 ordinal base
           6 number of functions
           6 number of names
    ordinal hint RVA      name
          5    0 0002399E beNotified
          2    1 0002396E getFuncsArray
          4    2 0002398E getName
          0    3 0002394E isUnicode
          3    4 0002397E messageProc
          1    5 0002395E setInfo


  • @zkirkland great dump.

Log in to reply