CBMSG function

Purpose

In a Callback Function, return the numeric value of the message sent by the caller.

Syntax

wMsg& = CBMSG

Remarks

Each type of message sent to your Callback Function has a unique numeric value. CBMSG will return the actual numeric message value of the message being processed. The definitions of the numeric values in other DDT functions (CBLPARAM, CBWPARAM, CBCTL, etc) can only be ascertained once CBMSG is identified. Therefore, Callback Functions usually test the value of CBMSG first.

In the generally case, a dialog Callback Function should return TRUE (non-zero) for all %WM_COMMAND messages it processes. However, this rule cannot be equally applied to other types of messages, since the return value will be message-specific.

The CALLBACK FUNCTION automatically copies the FUNCTION return result value over to the DWL_MSGRESULT data area, but only if the return value is non-zero, and the existing DWL_MSGRESULT value is zero. This helps reduce callback code size when dealing with custom controls and many Windows Common Controls.

For more information on return values for messages, consult WIN32.HLP or MSDN at http://msdn.microsoft.com.

See Dynamic Dialog Tools for more information on callbacks and messages.

Restrictions 

This function is only valid inside a Callback Function.

See also

Dynamic Dialog Tools, CBCTL, CBCTLMSG, CBHNDL, CBLPARAM, CBWPARAM

Example

CALLBACK FUNCTION DlgCallback() AS LONG

  SELECT CASE CBMSG

    CASE %WM_INITDIALOG

      ' process message

      FUNCTION = 1

    CASE %WM_USER

      ' process message

      FUNCTION = 1

    CASE %WM_COMMAND

      ' process the control notification

      FUNCTION = 1

  END SELECT

END FUNCTION