registerWindowMsg

registerWindowMsg(msgName:    String;
                  methodName: String): Integer;

The registerWindowMsg method of the Form class registers a Windows message with the JADE GUI environment so that when the message specified in the msgName parameter is received by that form, the method specified in the methodName parameter is called on the form object.

The parameters of the registerWindowMsg method are listed in the following table.

Parameter Description
msgName String used by the JADE GUI environment to call the RegisterWindowMessage Windows Application Programming Interface (API). This function defines a new Windows message number that is guaranteed to be unique for that workstation environment based on the specified name. Each subsequent call to RegisterWindowMessage by any application on that workstation returns the same message number.
methodName The name of the method that is called when the JADE GUI environment receives a message with the specified number from Windows for that form. The method must be defined and expect a single Integer parameter. The wParam parameter of the received Windows message is passed as the Integer parameter to the method. (For additional information about PostMessage or SendMessage, refer to the Windows documentation.)

The registerWindowMsg method returns the message number (msgNum) generated by the msgName parameter call on the RegisterWindowMessage API. For example, the following code fragment results in form1.specialCallBack(val: Integer) being called when a Windows message of msgNum is received by form1 in the GUI environment, where val is the value passed in the wParam value of the Windows message.

msgNum := form1.registerWindowMsg("My Special Call Back", "specialCallBack");

The PostMessage or SendMessage Windows call to generate the message must use the hwnd parameter of the form. Using an external method definition, for example, the message could be posted to JADE as follows.

call postMessage(form1.hwnd, msgNum, val, 0);

Multiple forms can register the same message name and each form can register multiple messages using different names.

Calling the registerWindowMsg method with the same message name a second time replaces the previous registration.

To remove the registered message, call the registerWindowMsg method with a null value ("") in the methodName parameter.