GuiSendMsg()

Sends a message to a window/control (to cause an event on that window/control).

error = GuiSendMsg(Control, MessageString, Data1, Data2, Data3, etc...)


Args

Control is the control to which the message is being sent. You should pass the name of the REXX variable that you associated with this control. The handle to the window containing this function must be stored in the GuiWindow variable.

You can alternately pass a window handle for the Control arg. For example, you can pass the handle to your window (gotten from the GuiWindow variable set by GuiCreateWindow) to send a message to the window itself (as opposed to a particular control in the window), or pass a handle gotten with GuiGetCtl().

If Control is omitted, then the value of the GuiWindow variable is automatically used.

Message is the message string for the desired operation. Each type of control will have its own message strings. For example, to select an excerpt of text in an ENTRY, you can send a "SETSEL" message.

Note: If you preface the Message string with "POST", then the message is posted instead of sent. What this means is that GuiSendMsg returns before the message is actually processed by the control/window. The message will not be processed until your script again calls GuiGetMsg(). This is useful if you want to first complete some activity before the control/window processes whatever message you have sent. For example, you can specify "POST SETSEL" to post a SETSEL message to an ENTRY control.

Data1 is the first piece of data passed along with the message. What you pass here depends upon the message. Some messages do not utilize this and you can omit it in that case. A message may require more pieces of data as well.


Returns

If successful, an empty string is returned. If an error, an error message. Also, if successful, then GuiSignal is set to whatever the window/control returned to you as its response to the message. Depending upon the message, you may need to use CONVERTDATA() to reformat it into something suitable for your REXX script to access.

Note: If you post a message, then GuiSignal is not really useful. There is no way to get the return of a posted message.