I been using notepad++ and it is my faworite notepad. However from time to time I'd need some extra functionalty...
My question is if it's possible to develop plugin with C#.net (what would be much easyer for me than with c++).
Gregor
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Actually, I'm afraid there is no way to make a plugin only with C#. The reason is simple : C# can only make COM object and can't implement a flat C++ API.
There is still a solution : make a minimal C++ plugin that will communicate with Npp and with the C# plugin.
here is an example inspired by the NppInsertDemo plugin :
in order to use it :
- of course the dotnet framework 2.0 or above need to be installed
- copy NppDotnetPlugin_Cpp.dll in the Npp plugin directory.
- copy somewhere else NppDotnetPlugin_Cs.dll and add it to the GAC (with the command gacutil /i NppDotnetPlugin_Cs.dll)
I hope it's enough to make it work, I didn't experiment that installation on another computer than my own one.
To program, I used MS Visual C++ Express 2005 + Platform SDK (to be able to make native dll) and MS Visual C# Express 2005.
I still didn't succeed in implementing a dockable plugin, actually I don't exactly know where to start. If anyone can do that, I would be very pleased !
A great evolution would be to make a C++ plugin that could load dynamically any C# dll (then no more need to compile a specific C++ dll for each C# plugin). But the use of reflexion is necessary and I don't know C++ enough to do that myself.
Now, I'll start programming a real plugin.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would like to do some plugin also in C#. But like the previous poster I don't know how to get started with plugin programming in C#. It would be great if somebody could make an example plugin like the one which is available for C++.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would love to be able to write the plugin in pure .net, with no depended c++ dlls.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2009-11-21
Right, what you need is a small C++/CLI wrapper.. there's no way around. But with a nicely coded wrapper you could get full C# access to the N++ API… also to WM_xxx messages and what not. Out of curiosity I was going to try on such a wrapper. If I'll manage to do it, I'll report back of course. I think many new plugins would pop up for N++, once there's a smart way to do it in .NET. I think my approach of wrapping will be a more generic one.. with the .net plugin placed into N++ plugin folder.. also no use GAC, as I don't like it at all, nor do I see sense in it.
Greets
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I been using notepad++ and it is my faworite notepad. However from time to time I'd need some extra functionalty...
My question is if it's possible to develop plugin with C#.net (what would be much easyer for me than with c++).
Gregor
Actually, I'm afraid there is no way to make a plugin only with C#. The reason is simple : C# can only make COM object and can't implement a flat C++ API.
There is still a solution : make a minimal C++ plugin that will communicate with Npp and with the C# plugin.
here is an example inspired by the NppInsertDemo plugin :
http://artiche.info/npp/NppDotnetPlugin.zip
in order to use it :
- of course the dotnet framework 2.0 or above need to be installed
- copy NppDotnetPlugin_Cpp.dll in the Npp plugin directory.
- copy somewhere else NppDotnetPlugin_Cs.dll and add it to the GAC (with the command gacutil /i NppDotnetPlugin_Cs.dll)
I hope it's enough to make it work, I didn't experiment that installation on another computer than my own one.
To program, I used MS Visual C++ Express 2005 + Platform SDK (to be able to make native dll) and MS Visual C# Express 2005.
I still didn't succeed in implementing a dockable plugin, actually I don't exactly know where to start. If anyone can do that, I would be very pleased !
A great evolution would be to make a C++ plugin that could load dynamically any C# dll (then no more need to compile a specific C++ dll for each C# plugin). But the use of reflexion is necessary and I don't know C++ enough to do that myself.
Now, I'll start programming a real plugin.
I tried your app, but I couldn't get it to recognize WM_ messages, is there something i'm missing?
I would like to do some plugin also in C#. But like the previous poster I don't know how to get started with plugin programming in C#. It would be great if somebody could make an example plugin like the one which is available for C++.
artiche, your post gives me host that I can use C# or VB.net to write a plugin for my fav code editor - Notepad++.
You say that we need to use a c++ dll becuase c# cannot call flat c++ apis. Can this page help? http://msdn.microsoft.com/en-us/magazine/cc301501.aspx
I would love to be able to write the plugin in pure .net, with no depended c++ dlls.
Right, what you need is a small C++/CLI wrapper.. there's no way around. But with a nicely coded wrapper you could get full C# access to the N++ API… also to WM_xxx messages and what not. Out of curiosity I was going to try on such a wrapper. If I'll manage to do it, I'll report back of course. I think many new plugins would pop up for N++, once there's a smart way to do it in .NET. I think my approach of wrapping will be a more generic one.. with the .net plugin placed into N++ plugin folder.. also no use GAC, as I don't like it at all, nor do I see sense in it.
Greets