01-12-2020 06:05 AM
I have a TestStand system which generates debug messages as OutputMessages from compiled code modules (LabVIEW PPLs / dll's etc). I need to save the OutputMessages to a file at the end of execution.
I am unable to find a reference to OutputMessages, I am aware of the CopyMessagesToCollection method once I have the aforementioned reference. I cannot do this is in a user interface as that is locked down too and I only have control over the top level sequence.
Thanks in advance.
01-13-2020 02:03 AM
I don’t see how you can achieve this if you don’t have a reference to the Output Messages being used by the UI.
01-13-2020 08:43 AM
I'm not aware of any way to get the OutputMessages object other than reading the UIMsg_OutputMessages UI Message:
https://zone.ni.com/reference/en-XX/help/370052W-01/tsapiref/reftopics/uimessagecodes/
The only way that comes to mind without changing the UI is that you could turn on "Station Options » Preferences » Debug Options » Send Output Messages to the Debugger" option and then use a tool like DebugView from Microsoft to read them all: https://docs.microsoft.com/en-us/sysinternals/downloads/debugview
Hope this helps!
Trent
01-31-2020 04:56 AM
I asked support a similar question a while ago. The bottom line of the answer is: No.
---
My two cents:
If it is your intention to log data from inside steps then consider to use the "Additional Results" and grab the data from "Locals.ResultList". Depending on what you want to achive the default behavior is good enough for you that shows the additional results in the standard report.
01-31-2020 11:18 AM - edited 01-31-2020 11:20 AM
I wouldn't say this is supported, and you might hit a problem, but I've been able to get UIMessages in arbitrary code modules by.
1. Instantiate the engine if you don't have it. It is a singleton, so this is just a way to get to it.
2. ApplicationMgr appMgr = (ApplicationMgr)engine.GetInternalOption(InternalOption_ApplicationManager) // presumes you are in an app that uses the ApplicationMgr control
3. Subscribe/connect to appMgr.UIMessageEvent, look for UIMsg_OutputMessages
You might need to subscribe in a new thread that has a message pump if your current thread can't be relied on to stay around and pump messages. I don't remember off the top of my head if the thread needs to be STA or not.
I'm not recommending this if you have other options, since it is off the beaten path, but it can enable things that wouldn't be possible otherwise.