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.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send data from OI to PM (MFC)

I created an Operator interface (OI) using MFC. I added an edit box so user can enter the serial number on the OI to avoid without using the PreUUT pop up to get the serial number. Is there any way to send the string from the OI to the process model (PM)? I know how to  get data from the PM to the OI using the "GetCaptionText" method but is there a way to send the data from OI to PM maybe like "SetCaptionText"      
0 Kudos
Message 1 of 5
(3,241 Views)
Hi caviars,

What you can do is have your sequence file post a UIMessage when you want to retrieve that data.  Your OI will be running and when it sees that a UIMessage has been posted, it will immediately run a section of code that you specified.  This code would retrieve the serial number and set it as a local variable in your sequence or whereever you want to save it to. 

Here is a link to an example online about how to use UIMessages.  You will want to take a look at uimessagesvcusingmfc.zip.  If you have any questions, please let me know.
0 Kudos
Message 2 of 5
(3,210 Views)
An important thing to note is you can use UI messages to pass an ActiveX parameter (a Local Variable for example), set the Synchronous parameter to true, and allow the UI Message Handler to set the Local variable.

Allen P.
NI
0 Kudos
Message 3 of 5
(3,206 Views)
I tried the PostUIMessage method and it works. However, should i change the PostUIMessage_Ex since the PostUiMessage is obselete.
I'm trying to create a progess bar to track my mainsequence. I tried the ConnectCaption( CaptionSource_ProgressPercent) but its not displaying my Testsequence progresss. I did display a progess percentage but i don't know for what process.
If i'm using PostUImessage (UIMsg_ProgressPercent) how often do i need to keep updating my UI? Is there any function to attach the progress bar from the UI to teststand progress indicator. 
0 Kudos
Message 4 of 5
(3,192 Views)
I solved the previous problem. I use the PostUIMessage in the PM to update my UI everytime a step execute. I also can attach a status bar to monitor  progress by using the ConnectNumeric method. Previously my mistake was I tried to connect a status bar to a captionsource using connectcaption. The correct way is to connect a status bar pane to the numericSource not captionsource. 
0 Kudos
Message 5 of 5
(3,178 Views)