Building a Notepad add-on

Tutorial

For this example, we will be building an add-on for Notepad. We will be able to create a RDM Notepad session that can load a txt file each time this session is called.

An add-on is only a simple library (.dll) loaded dynamically by the application.

This example is only for executing an external process.

Step1
Prepare the project

  1. Download the template "MyFirstAddOn" and unzip it in a new folder.
  2. Before opening it in Visual Studio, execute a "Replace in files" of the "MyFirst" segment with your new name in the project folder. Rename all files accordingly to the new name.
  3. Copy "RemoteDesktopManager.exe" from your installed version to your "bin\debug" directory.
  4. Open the newly created project.

Step2
Debug the add-on

To be able to debug your add-on, go in the menu Project-> Edit "<New AddOn name>" Properties and in the Debug tab page;

  1. Set the Start Action to "Start external program".
  2. Set the path value to the executable of RDM in your "bin\debug" directory.
  3. Set also the "Working directory" to the same folder.

Step3
Setup the add-on images

The AddOn directory contains two .png files. These files are used as icons for your add-on. It’s possible to customize those icons and replace them by something with the same size (16x16 and 32x32 pixels).


Step4
Develop the add-on configuration structure

RDM contains a mechanism to save and load a configuration. Usually it saved in XML.

  1. Open "YourAddOnNameConfiguration.cs" and declare the parameters needed for the execution of your process. For example:
public bool ShowMaximized
{
get;
set;
}

public string FileName
{
get;
set;
}

Those are C# automatic properties that will be handled by save and restore procedures of RDM. You can add as many as you need.


Step5
Develop the add-on configuration window

  1. Open the file "YourAddOnNameEditor.cs"
  2. The two example parameters are there too. You just have to follow the same way to edit and update yours in LoadInControls and SaveFromControls methods.
  3. Other methods are documented in the source code.
  4. You can add any logic that you need in this form to enter and validate the required information.

Step6
Implements the Add-on execution

Open the file "YourAddOnNameAddOn.cs" and set the default constant values

  1. Open "YourAddOnNameConfiguration.cs" and declare the parameters needed for the execution of your process. For example:
APPLICATION_DEFAULT_PATH
APPLICATION_EXECUTABLE
APPLICATION_NAME
ADDON_ID

Don’t forget that this example launch Notepad by default.

The most important method in this class is ConnectExternal. You must set the arguments string to the values needed by your program. It is simply the command line arguments.

You can experiment with the other properties and see what happen.

Compile, execute and enjoy...

When everything works fine, copy the new library into the installation directory of RDM. RDM detect and load all the Add-ons available in his folder at the application startup.

Please visit our Online Help or Devolutions Forum for more information or technical support.