11-28-2012 12:54 PM
I'm trying to send a UI Message from a C# program and can't seem to get it to work. I want to send it when the user press a button. Does anyone have any examples of how to do this? I've looked at the white paper for the PostUIMessageEx command, but can't seem to get it to work.
Thanks
11-29-2012 02:08 AM
While you can send UI messages from a C# code, it is not meant the way you think it works.
A UI message is always sent from a running execution to the UI, not from the UI to the engine (or execution or whatever).
So PostUIMessageEx is not an API function you normally find in the code for a UI, but you will find a UI Message Handler module there.....
What is the function you want to connect to the button? Is it a default functionality of TS?
hope this helps,
Norbert
11-29-2012 07:48 AM
We've created a custom GUI and I need to send an update from one C# application to another. Since it is going to be a user induced update rather than TestStand sending the update, we don't want to clutter our sequence file with a bunch of loops that have the potential to never be entered into. Since our applications already handle the UI messages, as we use them from TestStand to control other features, we want to define our own messages and just send them out from our GUI.
11-29-2012 10:45 PM
Hi,
If you are just sending a message from one C# app to another perhaps a non-TestStand way would be better, like a shared que or tcp. PostUIMsgEx is a method in the thread class so it needs to come from inside an execution out to a UI as the other poster mentioned.
TestStand UI applications should be as thin as possible, and only serve to view executions and send commands to TestStand. You generally lose portability, scalability, UI decoupling when you start putting code in the UI that does much else. There's always exceptions to the rule, but that rule is put your code into your sequences and just run them from the UI. If you don't want to clutter your test sequence, you could create other small sequences that launch in separate threads in response to UI button clicks.
cc