SendWindowMessage Method

Applies To

Task object.

Description

Sends a Windows message and its associated parameters to the specified task. On the Macintosh, this method isn't available and generates an error.

Syntax

expression.SendWindowMessage(Message, wParam, lParam)

expression Required. An expression that returns a Task object.

Message Required Long. A hexadecimal number that corresponds to the message you want to send. If you have the Microsoft Win32 Software Development Kit, you can look up the name of the message in the header files (Winuser.h, for example) to find the associated hexadecimal number (precede the hexadecimal value with &h).

wParam, lParam Required Long. Parameters appropriate for the message you're sending. For information about what these values represent, see the reference topic for that message in the Win32 online Help included with the Microsoft Win32 Software Development Kit. To retrieve the appropriate values, you may need to use the Spy utility (which comes with the kit).

See Also

Activate method, Tasks property.

Example

If Notepad is running, this example displays the About dialog box (in Notepad) by sending a WM_COMMAND message to Notepad. The SendWindowMessage method is used to send the WM_COMMAND message (111 is the hexadecimal value for WM_COMMAND), with the parameters 11 and 0. The Spy utility was used to determine the wParam and lParam values.

For Each myTask In Tasks
    If InStr(myTask.Name, "Notepad") > 0 Then
        myTask.Activate
        myTask.SendWindowMessage &h111, 11, 0
    End If
Next myTask