PhantomScript v1.7 Reference - Copyright © 2006 P1 Systems Incorporated. All Rights Reserved.

Prev | Next | Users Guide | PhantomScript Reference | P1 Systems


WindowsMessaging

SendWindowsMessage

Syntax

SendWindowsMessage
Handle=<hwnd>
Message=<msgnum>
[WParam=<wparam>]
[LParam=<lparam>]
[Timeout=<secs>]

Description

Sends a Windows message.

Parameters

Handle=<hwnd>

Required. The handle of the window to which the message is to be sent. This is normally obtained from a WaitForWindow or SetWindow statement.

Message=<msgnum>

Required. The numeric identifier of the message to send. For your own messages you should add an offset to the WmApp intrinsic variable to ensure that your message identifier does not conflict with a standard Windows message identifier.

WParam=<wparam>

Optional. A numeric parameter to pass to the destination with the message. The default is zero.

LParam=<lparam>

Optional. A numeric parameter to pass to the destination with the message. The default is zero.

Timeout=<secs>

Optional. The number of seconds to wait for the message to be processed before returning with the TimedOut intrinsic variable set to True. The default value is 5 seconds.

Remarks

The SendMessageCallback function sends the specified message to a window or windows. It calls the window procedure for the specified window and returns after the application has processed the message or after the specified timeout period has elapsed. See also SendWindowsMessage and WaitForWindowsMessage

Example

WaitForWindow Caption="MessageReceiver" Result=hwnd
SendWindowsMessage
Handle=hwnd
Message=WmApp + 1
WParam=66
LParam=28
Timeout=2

If TimedOut Then
MessageBox Text="Timed out" StayInFront Stop
EndIf

The above script fragment posts a message to the window with the caption "MessageReceiver" and returns after the application has processed the message or after 2 seconds.



Prev | Next | Users Guide | PhantomScript Reference | P1 Systems

PhantomScript v1.7 Reference - Copyright © 2006 P1 Systems Incorporated. All Rights Reserved.