From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX User Data Type Implementation

I am trying to read calibration information from a Photon Inc. Nanoscan system which uses ActiveX controls. I keep getting the following error: -2147417851 "The server threw an exception". The calibration information is stored in a structure which must be accessed through a pointer. It is a User Data Type defined in a file called Nanoscan.tlb  I'm attaching a file that a programmer sent me about how to implement this in C++. I'd like to figure out how to implement it in Labview, since I don't have a C++ compiler and the code he sent me is beyond anything I've done in C.
 
I've tried registering the .tlb file, but it just gives me the same properties and methods I can already see. I tried creating a cluster of string, single, single, converting it to variant, and passing that. If there is some way for Labview to see the iRecordInfo UDT of the .tlb file, that might get me there.
 
Here is the summary of the steps in the attached file:
 
1. Get ITypeLib pointer from the NanoScan type Library ( it uses the NanoScan GUID for this purpose)
2. Get the ITypeInfo and IRecordInfo pointers for the power calibration structure ( it uses the PowerCalibration GUId as defined in the NanoScan.tlb)
3. Create a VARIANT of VT_RECORD type.
4. Initialize the pRecInfo field of the variant with the IRecordInfo of the PowerCalibration structure.
5. Initialize the pvRecord field of the variant with a pointer to a power Calibration structure.
6. Pass the created VARIANT to the NsAsGetPowerCalibration together with the index of the power calibration to be retrieved. To find out how many calibrations are stored in the scanhead EEPROM, use the NsAsGetNumPwrCalibrations function.
7.Use the RecordCopy method to copy the VARIANT's record to the local power calibration structure.
 
0 Kudos
Message 1 of 2
(2,386 Views)
Hello,
 
You should be able to register the activeX control and use it in LabVIEW.  Perhaps the registration process was not successful, and I think you should have an ocx file associated with your activeX control.  To register it and begin using it in LabVIEW, please see the following document for registration instructions:
 
How Do I Manually Register Type Libraries, ActiveX Controls, and ActiveX Servers?
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
0 Kudos
Message 2 of 2
(2,366 Views)