NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing user messages with PostUIMessage method

I'm trying to pass a user-defined message from a TestStand sequence to a LabView-developed operator interface. When I wire the "UIMsg_UserMessageBase" TestStand API numeric constant to the Event Code in PostUIMessage, the UIMessage.Event value is 65536 (or at least not 10000) when read by the Operator Interface. The documentation says it should be 10000. If I wire a constant of 10000 to the Event Code, then I get the expected UIMessage.Event value, and everything works fine. Still I'm wondering why using the TestStand API Numeric Constant isn't working correctly for me. I'd rather use the TestStand API Numeric Constant for future compatibility reasons.

Thanks for your help.
0 Kudos
Message 1 of 12
(4,793 Views)
Hi!
Hi!

65536 in decimal format is the same as 10000 in hexadecimal.

With what you describe, I'm not sure if this is the only problem. You mention that if you wire 10000 everything works fine. Does this mean that when you use the constant it doesn't? What is the problem?

Marcela.
0 Kudos
Message 2 of 12
(4,794 Views)
If I use the TestStand API Numeric constant for the event code in PostUIMessage it doesn't work. The Message Handler of the Operator Interface is looking for UIMessage.Event = 10000 for a user-defined message.

The documentation for the message codes states "UIMsg_UserMessageBase - (Value: 10000) All user-defined error codes must be greater than or equal to the value of this constant."

I'd like to use the API constant for future version compatibility. That way if NI changes the message code values it wouldn't trash my software. Using the numeric constant makes the software more readable as well.

It would seem there is a hexadecimal/decimal conversion/confusion somewhere. I assumed that for "UIMsg_UserMessageBase - (Value: 10000)", the value
is decimal. It doesn't say in the documentation for UIMessageCodes what they are using.
0 Kudos
Message 3 of 12
(4,795 Views)
Wow this can get confusing, right?

You say that the message handler of the operator interface is looking for UIMessage.Event=10000. Is this 10000 decimal or hexadecimal? In any case, I think it should be looking for UIMessage.Event=UIMsg_UserMessageBase. This again for future compatibility issues.

You can try changing this in the message handler.
0 Kudos
Message 4 of 12
(4,795 Views)
Hi Jason,

In the TestStand Programmer Help, for UIMsg_UserMessageBase the value is 10000 (decimal).
When you post a 'UIMsg_UserMessageBase' message via an ActiveX Adapter in a sequence file, the value sent is 10000 (decimal) not 0x10000.
Therefore the TestStand API Numeric Constants.vi is clearly incorrect.

I would recommend you report this to NI via the 'ask for engineer' http://sine.ni.com/apps/we/niae_asc.main

Also, I found this via the Toubleshooting.
http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/eca77cae6d67757a8625694b0065bdfb?OpenDocument


Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 5 of 12
(4,795 Views)
Hi,

Actually the Default Labview OI doesnt trap for UIMsg_UserMessageBase or above.

The TestStand - UI Message Codes.ctl doesnt contain the UserMessageBase event. The last event in the list is Display Report (value=29).
Any trapping for UIMsg_UserMessageBase and above must be added by the user, to The VI TestStand - UI Message Handler.vi.

I do agree with you about using the teststand constants but first Jason needs to estabish which is correct from NI.

Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 6 of 12
(4,795 Views)
Thanks for your help. It confirmed my impression that the TestStand API Numeric Constants.vi UIMsg_UserMessageBase is incorrect. I'll bring this to the attention of NI and post any feedback from them here.

thanks again,
Jason
0 Kudos
Message 7 of 12
(4,795 Views)
Here was the response from NI:

Unfortunately you have come across an issue with the API constants ring control in LabVIEW where it returns the hex # instead of the decimal value desired. While this will be corrected in future releases of TestStand, for now you may need to either hard-wire the numeric value in, or do a quick morph on your data so that you can guarantee that it is the decimal value that is being passed into the UI message queue. Certainly hard-wiring the "10000" will always work with future releases, doing the conversion may require you coming back and removing the added subVIs at a later date or building in some logical detection so that once the API is fixed you don't accidentally convert a number that is already a d
ecimal.

I have flagged this issue for you in the database so that it will be rechecked in the next release.
0 Kudos
Message 8 of 12
(4,795 Views)
Thanks Jason.

Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 9 of 12
(4,795 Views)

I've been looking for information in the manuals and on this forum that describes how to create/post these UI messages (or more specifically user messages) from my TestStand sequence? I can't find any step type called UI Message or similar. What kind of step should I be adding to be able to send a user message to my custom GUI?

 

Thanks

Olle

 

0 Kudos
Message 10 of 12
(4,016 Views)