ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I call LabVIEW's ActiveX interface from .NET?

I'm trying to call a LabVIEW VI from C# using LabVIEW's ActiveX interface. I've successfully imported LabVIEW.tlb and can do a few simple things like load a VI into memory and run it.

But things get more complicated when I need to use a cluster output from one VI as the input to another. The return value of GetControlValue is, unfortunately, a System.Object refnum. This is useless for passing into LabVIEW: it's just a pointer.

How to I get C# to pass the System.Object refnum in as a Variant containing the actual cluster data instead of a Variant containing a 32-bit pointer? I'd even settle for flattening the C# object to some kind of string, but the ToString() method is useless: it returns "System.Object[]" ins
tead of an actual representation of the data.
0 Kudos
Message 1 of 2
(3,175 Views)
Hello -

I'm not familiar with C# commands, but I can point you to some useful information on LabVIEW and ActiveX:

You can obtain a description of all the methods and properties in the LabVIEW help. In LabVIEW 7.0 you should open help (Help >> VI, Function, & How-To Help). From the contents tab select Windows Connectivity >> ActiveX >> Properties & Methods. Here you will find information on the properties and methods that LabVIEW makes available.

This tutorial is a great introduction to LabVIEW and ActiveX.

I've also attached an example (written in LabWindows/CVI) which demonstrates how to use the LabVIEW ActiveX Automation interface to la
unch and run a LabVIEW VI. In this application the LabWindows/CVI example acts as the Automation Client to control LabVIEW through LabVIEW's Automation Server.

Good luck with your project and have a great day!

Becky B.
Applications Engineer
National Instruments
Becky Linton
National Instruments
Field Engineer
Office: 734-464-2463
Cell: 248-709-2822
Email: becky.linton@ni.com
0 Kudos
Message 2 of 2
(3,175 Views)