NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

"Incorrect function" error on PostUIMessageEx in Labview with Labview runtime

Solved!
Go to solution

Hi,

 

It seems that all TestStand references are updated constantly. I have been trying to pass RunState.Engine, RunState.Thread, RunState.Execution and even RunState.Root.AsSequenceContext because I thought that these were kind of stable throughout my execution (since I don't do multi-threading and I don't launch new executions), and all of them are different each time I call directly my VI to change the StationGlobals. I really thought that a reference was a reference, but somehow, it is not. Anyways, I am stucked on this issue.

 

Thanks

Alex

 

p.s. The Incorrect function error comes from the fact that the reference is no longer valid in Labview. The error should be changed by something that makes more ssense, such as Invalid reference or something like that. We could save a good amount of time troubleshooting our application...

0 Kudos
Message 11 of 14
(1,381 Views)
Solution
Accepted by topic author alex b.

Alex -

 

I believe what's happening is that the reference is no longer valid because you aren't adding to the reference count for the Thread reference. TestStand ActiveX references automatically close when the VI code module finishes executing and returns to TestStand. In order to keep the ActiveX reference around, you will need to wire it to the Variant to Data function. This is explained in detail in the Duplicating COM References in LabVIEW Code Modules section of the Using LabVIEW and LabWindows/CVI with TestStand Manual.

 

I have attached a simple example that will run with TestStand 4.1.1 and LabVIEW 8.6.1 that demonstrates this concept. Please make sure that you are implementing this concept in your own Functional Global VIs and test it out. Let me know if this resolves the problem.

Manooch H.
National Instruments
Message 12 of 14
(1,357 Views)

Alex -

 

I wanted to follow up with you and see if you had a chance to look at the example I provided. Also, I wanted to ask if you are calling your sequence file from the TestStand Sequence Editor, or from a LabVIEW user interface. If you are calling it from a LabVIEW UI, are you calling this same Trace VI in your LabVIEW UI?

 

Please let me know how things are going as I would really like to confirm that your issue is resolved.

Manooch H.
National Instruments
0 Kudos
Message 13 of 14
(1,315 Views)

Hi Manooch_H,

 

this is an old thread on the forum but it helped me. (Current project in LV2013 and TS2013)

 

I had issues passing the sequence context to a class with an active object.

 

Now I pass the sequence into the create of the object and before adding it to the attributes I use the variant to data vi to copy the ref.

 

Works great.

 

Thanks.

0 Kudos
Message 14 of 14
(997 Views)