Virtual Serial Ports - Software Virtual COM Port Null Modem Cable Emulator for Windows
Docs

Virtual Serial Ports API

Virtual Serial Ports provides rich API to control virtual serial ports creation and management. Any library caller must have sufficient rights to enumerate and/or create devices (install device drivers). It also usually means that the caller must be elevated even if it is running as Administrator.

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_vyserlib.dll"

or

#import "progid:vyserlib.VirtualSerialLibrary.3"

or

#import "libid:7DC6F544-8B95-41AB-97FE-7F6293CB461B" version("3.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:

vyserlibLib::IVirtualSerialLibraryPtr pLibrary;
if (SUCCEEDED(pLibrary.CreateInstance(__uuidof(vyserlibLib::VirtualSerialLibrary))))
{
  // create new virtual serial port with automatically-assigned port name
  auto pNewPort = pLibrary->${createDevice}();   
  // manually tell which port to create
  auto pCom10 = pLibrary->${createDevice}(L"COM10");   
  // create a permanent local bridge
  pCom10->${createBridge}(pDefaultDevice, VARIANT_TRUE); 
}

Using from JavaScript

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

var library = new ActiveXObject("vyserlib.VirtualSerialLibrary.3");

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

// create new virtual serial port with automatically-assigned port name
var port1 = library.${createDevice}();  
// manually tell which port to create
var port2 = library.${createDevice}("COM10");  
// create a permanent local bridge
port1.${createBridge}(port2, true);  

Using from Typescript

Virtual 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="vyserlib.d.ts" />
var library = (${IVirtualSerialLibrary}) new ActiveXObject("vyserlib.VirtualSerialLibrary.3");
// create new virtual serial port with automatically-assigned port name
var port1 = library.${createDevice}();  
// manually tell which port to create
var port2 = library.${createDevice}("COM10");  
// create a permanent local bridge
port1.${createBridge}(port2, true);  

IVirtualSerialLibrary createDevice createBridge