The CountVirtualPort property returns information about number of virtual serial ports already created.  

LONG CountVirtualPort; 

 

Note: If the virtual serial port was not created, the return value is zero. Property available for Windows NT4/2000/XP/2003/Vista.
Tip: See also: EnumVirtualPort method