Skip to content

WindowsMessage

See Also: Miscellaneous Functions

Purpose

Send a message to the Windows message queue for the current object.

Return Type

Handle

Syntax

Use GlobalFunctionsProcedures.pkg
(WindowsMessage( {iMsg}, {wParam}, {lParam} ))

Where:

  • {iMsg}: An integer value that specifies the message to be sent.
  • {wParam}: A wide integer that specifies additional message-specific information.
  • {lParam}: A long integer that also specifies additional message-specific information.

What It Does

WindowsMessage sends the specified message to the window handle retrieved from the current object. The return value specifies the result of the message processing and depends on the message sent.

Examples

Example 1: Retrieve Progress Bar Position

Function piPosition Returns Integer
    If (Window_Handle(Self)) Begin
        Function_Return (
            WindowsMessage(PBM_GETPOS, 0, 0)
        )
    Else 
        Function_Return 0
    End_Function

The above example shows how to use WindowsMessage to retrieve the progress bar position of the cProgressBar object.

Example 2: Retrieve Next Sibling in TreeView

Function NextSibling Handle hItem Returns Handle
    Move (
        WindowsMessage(TVM_GETNEXTITEM, TVGN_NEXT, hItem)
    ) to hItem
    Function_Return hItem
End_Function

The above example shows how to use WindowsMessage to retrieve a handle to the next sibling of a passed node in a TreeView object.

Notes

The WindowsMessage function uses delegation to obtain a window handle of the window that will process the message.

Use of the WindowsMessage function requires Windows API knowledge about the message being sent and the control that will process the message.