NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Help needed sending a UI activex reference back to teststand

Hi again folks, next conundrum.

 

I have inherited a large user test GUI that besides other things, sets up an active x control to write to a database, all works fine within the GUI.

 

However I need to write to this same database reference, from within the teststand script that's being run.

 

Effectively I need to pass the COM reference generated by the GUI, to a variable in the script. So that when the script runs it's VI to write to the database, it can pick up the reference that's already been generated by the GUI.

 

I have tried making use of this tutorial to accomplish this but it's not worked so far: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000kHD9SAM&l=en-GB

 

Attached are some screenshots.

 

Please help!

 

Thanks, Tom

Download All
0 Kudos
Message 1 of 20
(3,204 Views)

Why don't you make your local variable an object reference and then in your set teststand property value change it from a string to an object?

 

That way you don't have to typecast to a number and then a string.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 20
(3,188 Views)

Hi yes I had actually though of that too. But that aside, should this work? Have I done it correctly?

 

Will the value magically land in locals.X3ID? or do I need a more elaborate/accurate lookup string?

 

Excuse my lack of LV experience.

0 Kudos
Message 3 of 20
(3,181 Views)

Actually wiring the refnum to type object didn't work, I got the following:

 

"You have connected a refnum of one type to a refnum of another type and both types are members of some class hierarchy, but there is neither a simple up cast nor type cast between the two classes."

0 Kudos
Message 4 of 20
(3,171 Views)

I went and looked at some code where I was passing the Application Manager back to my sequence file (not recommended in most cases).  It is an ActiveX object and I realized I used the SetValVariant method.

GetAppMgr_UserMessageCallbackVI.jpg

 

 

 

 

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 5 of 20
(3,128 Views)

So from looking at your example my code looks viable right?

 

I have "X3 Com Refnum" set to deliver to "Locals.X3ID" as a string, under event case number "10010"

 

In my sequence I have the following statement:

 

"RunState.Thread.PostUIMessageEx(UIMsg_UserMessageBase + 010, 0, "" , Nothing, True)"

 

How exactly will that statement trigger the VI to deliver that value to the required variable, and do I need to use a parameter instead of local variable?

 

Many thanks!

0 Kudos
Message 6 of 20
(3,108 Views)

You need to use the SetValVariant instead of the TestStand set property.  Look at my code.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 7 of 20
(3,091 Views)

Okay so I went into the Teststand Set Property node which contains the Invoke node and set it to SetValVariant. How does this screenshot look.

0 Kudos
Message 8 of 20
(3,076 Views)

So regarding your code, what do you put in your TS statement that causes this code to run and populate the variable?

 

Thanks!

0 Kudos
Message 9 of 20
(3,071 Views)

My screenshot shows what I put in my TestStand sequence to invoke this callback.  In my case I'm sending the application manager which is an active X control.  In your case you will just send the active X reference from your first post.

 

Regards,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 10 of 20
(3,056 Views)