How to Find Serial COM Programmatically in LabWindows™/CVI™

Updated Jun 26, 2018

Reported In

Hardware

  • Serial Interface Device

Software

  • LabWindows/CVI

Issue Details

How can I find the serial resources (COM) I have in my computer programmaticaly in LabWindows™/CVI™?

 

Solution

In order to retrieve information about the hardware you have in your system the same as in NI MAX using LabWindows™/CVI™, you can use the NI System Configuration API. 

You can use the function: 
NISysCfgGetResourceIndexedProperty(resource, NISysCfgIndexedPropertyExpertResourceName, 0, resourceName);
NISysCfgGetResourceIndexedProperty(resource, NISysCfgIndexedPropertyExpertUserAlias, 0, alias);


For serial devices, the resourceName will give you the ASRL serial resource  name, and alias will give you the COM name, the same as NI MAX.

You can get most of the necessary information in the help of LabWindows™/CVI™ under Help>>Library Reference>>NI System Configuration. 

 

Additional Information

The NI System Configuration Application Programming Interface (API) for LabWindows™/CVI™ gathers information about devices on both local and remote systems. 

There is a good example under LabWindows™/CVI™ called ShowAllHardware .prj that displays all hardware on a given system as well as specified properties of that hardware. The example can be found under Find Examples>> Hardware Input & Output >>System Configuration.

WAS THIS ARTICLE HELPFUL?

Not Helpful