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 view Output Messages in the LabWindows UI?

In my LabWindows/CVI I would like to view the output messages that are sent from sequences:

"RunState.Engine.NewOutputMessage(Parameters.Message).Post()"

 

I thought there might be a TS UI Control like the one in the sequence editor called Output - but I can't find one.

 

So far I have managed to catch the message type (TS_UIMsg_OutputMessages) but I can't actually get the string from the event.

 

Does anyone have an example of doing this?

 

Thanks,

 

Ronnie

TestStand 4.2.1, LabVIEW 2009, LabWindows/CVI 2009
0 Kudos
Message 1 of 7
(3,788 Views)

Ronnie,

 

Here is an example of how we can use the UIMEssage and CVI http://zone.ni.com/devzone/cda/epd/p/id/6052 

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 2 of 7
(3,762 Views)

Richard,

 

The example you directed me to has the typical user message (10000+) but not the Output Message.

As I mentioned above, the Output Message is when you use:

 

RunState.Engine.NewOutputMessage("a message").Post() 

 

and it appears in the Output window.

 

CropperCapture[80].Png 

 

Hope this makes it clearer,

 

Ronnie

TestStand 4.2.1, LabVIEW 2009, LabWindows/CVI 2009
0 Kudos
Message 3 of 7
(3,757 Views)

Here is the text for this UIMessage from the online help for the UIMessageCodes Enumeration:

 

  • UIMsg_OutputMessages–(Value: 40) TestStand sends this message at periodic intervals when it holds references to output messages that calls to the OutputMessage.Post method queue. TestStand transfers the queued messages to an OutputMessages collection attached to the UIMessage.ActiveXData property for this event. An application that processes output messages should copy the output message references from the collection in UIMessage.ActiveXData to its own private OutputMessages collection by passing its private collection to the OutputMessages.CopyMessagesToCollection method. An application calls the Engine.NewOutputMessages method to create a private OutputMessage collection. TestStand generates this event only if the Engine.OutputMessagesEnabled property is True. Because there can be more than one handler for this event, the application should not modify the OutputMessages collection the UIMessage.ActiveXData property holds.


Hopefully this will give you a good starting point for where to look in the rest of the online help. Please let us know if you need more details.

 

Hope this helps,

-Doug

 

0 Kudos
Message 4 of 7
(3,744 Views)

Doug,

 

Yes - I have already seen all this. As usual it is implementing it in CVI that is the problem.

Posting to the discussion board is my last resort - especially with the TestStand/CVI issues.

 

Thanks,

 

Ronnie

 

TestStand 4.2.1, LabVIEW 2009, LabWindows/CVI 2009
0 Kudos
Message 5 of 7
(3,741 Views)

Ok, let me see if I can explain how to do it more clearly then.

 

 

1) Create a new OutputMessages collection using TS_EngineNewOutputMessages(). This collection will store your own private copy of the output messages. You can hold onto and add to this collection if you want to store them. If not you can just close the handle to free it once you are done with it.

 

2) When you get the UIMessage you need to get the ActiveXData property of it. I think the CVI function should be called something like TS_UIMessageGetActiveXData(). The CAObjHandle you get back from this function is a different OutputMessages object that you should NOT hold onto (because of multithreading reasons), you should instead close the handle before returning back from your UIMessage handler. Before doing that though, you should use the TS_OutputMessagesCopyMessagesToCollection method to copy the messages from this OutputMessages object to the new one you created in step 1) above (i.e. you are making your own private copy of the messages and leaving the ones in the UIMessage unchanged (again, it is for multithreading reasons that it must be done this way to avoid race conditions).

 

3) You now have a copy of the output messages from the event in your own private OutputMessages collection that you created in step 1) above. You can now access it to get the info for the output messages.  You can get the number of items it contains (and it might contain more than one), by using the TS_OutputMessagesGetItem() function and using CA_VariantInt(index) to package the integer that you pass for the index parameter.

 

4) Getting the item gives you an OutputMessage object (notice no plural). You can get information about the output message using the methods and properties of the OutputMessage class (see the online help for more info). There is more to an output message than just the message text. There is also a timestamp, category, location, icon, id, severity, color, etc.

 

If you need more information please let us know specifically what you are having trouble with or need more information about.

 

Hope this helps,

-Doug

Message 6 of 7
(3,728 Views)

Meant to say use TS_OutputMessagesGetCount() to get the number of items in step 3) in my previous post. Use TS_OutputMessagesGetItem() to get each item after you know how many there are.

 

-Doug

0 Kudos
Message 7 of 7
(3,725 Views)