.MESSAGE

Syntax

.MESSAGE messagenumber procname

Explanation

The .MESSAGE command allows you to create a Logo procedure which responds to a Windows message. The Windows operating system communicates with PC Logo by sending messages. When you select a menu item, Windows sends a message which contains a code meaning "a menu item was selected" along with the number of the selected item. The inputs to .MESSAGE are the number which your procedure should react to and the name of your procedure.

The procedure receives a list of three numbers as input. The first is the message number, The second is the contents of the wParam parameter, while the third is the contents of the lParam parameter.

If you define a message handling procedure, all messages arriving with the number you requested are routed to your specifed procedure. Other messages should be forwarded to PC Logo itself by using the .WNDPROC command.

You can turn off the message handler by calling the .MESSAGE command with the message number and FALSE as its second input.

A thorough knowledge of the Windows API and its messaging system is needed to safely respond to messages. It is easy to crash PC Logo or Windows with a wrong message handler.

See also .WNDPROC.

Example

The following procedure responds to the menu item "Help/Last error". When this menu item is selected. the message "HELP / LAST ERROR SELECTED" is displayed. All other menu selections are routed to PC Logo so PC Logo remains fully functional.

TO HELP_HANDLER :ARGS


 * IF (ITEM 2 :ARGS) = 1602 \


 * THEN PR [HELP / LAST ERROR SELECTED] \


 * ELSE .WNDPROC :ARGS

END

? .MESSAGE 273 "HELP_HANDLER

?