Posts

Showing posts from January, 2022

Donate

Notepad++ Plugin GetText Method Not Getting Entire String In C#

Image
Good evening, We have this Notepad++ Plugin project that will read and parse an html document converted from a MS Word file and then change the html string into an Adobe In Design format. The issue is that the html document has over 20,000 plus lines even reaching 40,000 lines or more. The code below will get all the text from an active Notepad++ window but fails if the string content is huge. public unsafe string GetText( int length) { byte [] textBuffer = new byte [10000]; fixed ( byte * textPtr = textBuffer) { Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXT, (IntPtr)length, (IntPtr)textPtr); return Encoding.UTF8.GetString(textBuffer).TrimEnd( '\0' ); } } After doing some debugging and troubleshooting, I found a solution that is to replace the size of the textBuffer variable from a static value 10000 to the actual length passed into the function parameter. public unsafe string GetText( int length) { byte [] textBuffer = new byte [length]; fix

Creating Your First Notepad++ Plugin Using Visual Studio 2019 And C#

Image
Hello, In this blog post, I'll demonstrate on how to develop a Notepad++ Plugin (64 Bit) using Visual Studio 2019 and C# assuming that you have installed a 64 Bit version of the latest Notepad++ Editor. This tutorial is based from kblisted Notepad++ Plugin Package in GitHub . The plugin's architecture can communicate with the Notepad++ or the underlying Scintilla engine using NotepadPlusPlusGateway and ScintillaGateWay and Win32 API. To start with, download the Notepad++ Plugin Pack from the GitHub page and copy the zip file to the Project Templates folder of your Visual Studio 2019 IDE. In my laptop, the path is "C:\Users\my_username\Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C#" . Open your Visual Studio 2019 IDE and create a project using the Notepad++ Plugin template. Change the Platform Target to x64. (Our OS is Windows 10 64 bit) Create a function called SetFirstCharAllWordsCap inside Main.cs that get's the entire string content

Donate