Remote Serial Ports - Network COM Ports/Devices Sharing/Redirecting Software for Windows
Docs

API Overview

Remote Serial Ports client installs an in-process COM server providing full-featured API to native, .NET or scripting clients. This documentation section describes the provided API in detail.

Any user code that intends to call any API method or use any API interface must have sufficient rights on the local computer. This means at least SeLoadDriverPrivilege privilege must be granted to the calling process and usually also means that the caller needs to be running elevated.

Using from Native Code

In order to use the API in native code, first use the #import directive to bring definitions into the scope:

#import "full_path_to_hhdclientctl.dll"

or

#import "progid:hhdclientctl.RemotePortLibrary.1"

or

#import "libid:C18B7B8C-07A8-4CA8-B19F-91D79F8F099F" version("1.0")

This will scan the type library and generate wrappers for interfaces and enumerations.

Then, use the generated definitions. For example, to create an instance of the library object, use the following code:

hhdclientctl::IRemotePortLibraryPtr pLibrary;
if (SUCCEEDED(pLibrary.CreateInstance(__uuidof(hhdclientctl::RemotePortLibrary))))
{
      // create new virtual serial port with automatically-assigned port name
      auto pNewPort1 = pLibrary->${createPort}();   
      // manually tell which port to create
      auto pNewPort2 = pLibrary->${createPort}(L"COM10");
      // configure created port
      pNewPort1->put_${remoteHost} = L"hostname";
      // ...
}

Using from C#

In order to use the library from C# project, Right-click the References project folder in Microsoft Visual Studio and add a reference to the hhdclientctl.dll library. After this is done, add the using declaration to the source file:

using hhdclientctl;

Use the API provided by the library:

var library = new hhdclientctl.${IRemotePortLibrary}();
var port1 = library.${createPort}();
port1.${remoteHost} = "remote.hostname";
port1.${remotePort} = 5;
port1.${login} = "username";
port1.${password} = "password";
port1.${domain} = "domain";
// ...

Using from JavaScript

To create an instance of the library, use the following code:

var library = new ActiveXObject("hhdclientctl.RemotePortLibrary.1");

Then, use the library object to create and manage virtual serial devices:

// create new virtual serial port
var port1 = library.${createPort}();
// manually tell which port to create
var port2 = library.${createPort}("COM10");
// configure serial port
port1.${remoteHost} = "remotehostname";
port1.${remotePort} = 5;
// ...

Using from TypeScript

Remote Serial Ports library contains TypeScript definition files that simplifies library usage in scripting environments. It automatically gives you method parameter type validation and simplifies specifying callback methods.

///<reference path="clientctl.d.ts" />
var library = (${IRemotePortLibrary}) new ActiveXObject("hhdclientctl.RemotePortLibrary.1");
// create new virtual serial port with automatically-assigned port name
var port1 = library.${createPort}();
// manually tell which port to create
var port2 = library.${createPort}("COM10");
// configure port
port1.${remoteHost} = "remotehostname";
port1.${remotePort} = 5;
// ...

IRemotePortLibrary createPort remoteHost remotePort login password domain