NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I programmatically set the AllowStructPassing flag for a container.

Problem:

I want programmatically (in C++) create a custom data type (a container) in a palette and set the AllowStructPassing flag for it.

 

I can create the container as a PropertyObject (there is an example of that on this forum). But how do I do to set the AllowStructPassing and stuff like that.

There are methods in the CommonCAdapter class that seems to do the trick but I don’t know how to get to there from my PropertyObject.

 

Anyone has an Idea?

0 Kudos
Message 1 of 3
(2,745 Views)

Solved it myself.

 

1)       Get an adapter with GetAdapterByKeyName("DLL Flexible Prototype Adapter")

2)       Got the interface ID (manually) for CommonCAdapter with OLE/COM object viewer (for QueryInterface)

3)       Used OLE functionality (QueryInterface, GetIDsOfNames and Invoke) to call the functions.
CommonCAdapter has the object to operate on as argument to all it’s functions. 

 

Why isn’t those interfaces (Adapters etc) supported in the same way as PropertyObject etc. It would have saved some time…

0 Kudos
Message 2 of 3
(2,737 Views)

ladr,

1. Get the Adapter with Engine.GetAdapter or EngineGetAdapterByKeyName
2. Use the adapter reference and call CommonCAdapter.SetAllowStructPassing using the type definition object (container).

As you can see in the TestStand API reference poster. The DllAdapter and the CVIAdapter are CommonCAdapters ('derive').
Both adapters share the methods and properties of the CommonCAdapter class.
So you can use the reference obtained from the Engine.GetAdapter method and call the CommonCAdapter methods and properties directly.

Keep on mind that the adapters related methods are exposed in a separate automation server called "NI TestStand Adapter API".

Hope it helps.

If you have any question let me know.

Antonio.


 

 

0 Kudos
Message 3 of 3
(2,731 Views)