NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Mixing CAObjHandle and IDispatch *

Hi,
I am calling a DLL from TestStand which is written in MS Visual C++. This DLL now calls another DLL written in CVI. The C++ DLL receives "ThisContext" from TestStand as an IDispatch pointer. This parameter has to be passed down to the CVI DLL, but this DLL expects the sequence context to be a CAObjHandle. Is there any way to get the CAOBjHandle information from the IDispatch pointer, or should I better try the other way round, i.e. make the C++ library take a CAObjHandle and convert it to an IDispatchPointer?

Best Regards

Michael Kammerer
Rohde & Schwarz
0 Kudos
Message 1 of 3
(3,103 Views)
The C++ DLL could call the CVI method CA_CreateObjHandleFromInterface to create a CAObjHandle when you already have an interface pointer to an ActiveX object. This means that the C++ DLL will have to link to the CVI RTE. Upon returning from the call to the CVI DLL, release the handle with a call to CA_DiscardObjHandle.

Scott Richardson (NI)
Scott Richardson
https://testeract.com
0 Kudos
Message 2 of 3
(3,103 Views)
Like Scott mentioned you can do it by integrating the RTE from Labwindows CVI into your C++ dll. There is a easier way in my opinion that leaves your dll in CVI untouched.
Pass to your CVI DLL the normal LPDISPATCH. In CVI you need the CAObjhandle but with the CVI function CA_ServerGetObjHandleFromIface you can convert this to a CAObjHandle

Kind regards Kurt
0 Kudos
Message 3 of 3
(3,103 Views)