Post Message

 

The PostMessage command allows the user to send a Windows message to the specified control.

 

Note: This command is designed for experienced users of Windows messaging. We are unable to provide support for explaining how Windows messages work, what are the various messages available and what they do, etc.

 

 

Script Editor > Expand System Category > Post Message

 

 

Post Message To

Select the variable to receive the message information.

 

 

Message Type to Post

Next select the type of message to post. The five types are listed below.

 

Use Constant Name Contained in a File

The user specifies an ini file containing a list of constant names and their values. The "Message to Post" field should contain a constant name from this file.

 

An example would be the WM_LBUTTONDOWN message in the PostMessage.ini file. In the file, the following line appears:

 

WM_LBUTTONDOWN=513

 

This means that when the user specifies WM_LBUTTONDOWN as the message, message 513 is actually sent.

 

Constants File    

The user specifies in the "Message to Post" field a message number to send to the specified control.   

 

Use Numeric Value

The user specifies in the "Message to Post" field a message number to send to the specified control.

 

Offset from WM_USER

WM_USER is a Windows constant that marks the beginning of the messages that programmers can use for anything. In this case, the user specifies either a positive or negative number that is added to WM_USER. Currently, Windows defines WM_USER as 1024.

 

Use RegisterWindowMessage

This command allows the user to enter a constant string that can be used by Windows to generate a message. This is primarily used to communicate with other applications that have registered the same message.

 

Offset from WM_APP

WM_APP is a Windows constant that marks the beginning of the messages that programmers can use for anything. In this case, the user specifies either a positive or negative number that is added to WM_APP. Currently, Windows defines WM_APP as 32768.

 

 

Message Information

The message input into this field comes from one of three sources. The message will be a constant from the Constants file, a string passed to RegisterWindowMessage, or a value from WM_USER.

 

WParam - LParam

These fields allows the user to specify the WParam and LParam parameters. The contents of these parameters depend upon the message being sent. These values can be found in the Platform API library at https://msdn.microsoft.com.

 

 


 

 

Microsoft Definition of RegisterWindowMessage

The RegisterWindowMessage function defines a new window message that is guaranteed to be unique throughout the system. The message value can be used when sending or posting messages.

 

The RegisterWindowMessage function is typically used to register messages for communicating between two cooperating applications.

 

If two different applications register the same message string, the applications return the same message value. The message remains registered until the session ends.

 

Only use RegisterWindowMessage when more than one application must process the same message. For sending private messages within a window class, an application can use any integer in the range WM_USER through 0x7FFF.

 

Note: When Macro Express is installed, three .ini files ( PostMessage.ini, PostCommCtrl.ini and PostRichEdit.ini ) are also installed into the Macro Express folder. The default path is C:\Program Files\MacExp3.0. These .ini files contain message definitions that may be used for reference. Double click on the files to open and view in Notepad or Wordpad.

 

 


 

 

Additional Window Message Information

The following quotes from Microsoft provide additional information about Windows Messages.

 

"The system passes input to a window procedure in the form of messages. Messages are generated by both the system and applications. The system generates a message at each input event — for example, when the user types, moves the mouse, or clicks a control such as a scroll bar. The system also generates messages in response to changes in the system brought about by an application, such as when an application changes the pool of system font resources or resizes one of its windows. An application can generate messages to direct its own windows to perform tasks or to communicate with windows in other applications.

 

The system sends a message to a window procedure with a set of four parameters: a window handle, a message identifier, and two values called message parameters. The window handle identifies the window for which the message is intended. The system uses it to determine which window procedure should receive the message.

 

A message identifier is a named constant that identifies the purpose of a message. When a window procedure receives a message, it uses a message identifier to determine how to process the message. For example, the message identifier WM_PAINT tells the window procedure that the window's client area has changed and must be repainted.

 

Message parameters specify data or the location of data used by a window procedure when processing a message. The meaning and value of the message parameters depend on the message. When a message does not use message parameters, they are typically set to NULL. A window procedure must check the message identifier to determine how to interpret the message parameters."

 

Note: Do not confuse the PostMessage command with the Windows SendMessage command. The Windows SendMessage command allows several different types of data to be sent to an application. For example, a message parameter may contain an integer, packed bit flags, a pointer to a structure containing additional data, and so on.

In addition, the SendMessage command allows a value to be returned to the program that sent the message. However, the Macro Express PostMessage command is patterned after the Windows PostMessage command. PostMessage only supports integer values in these parameters and does not support a returned value.