Syntax
WaitForWindowsMessage
Message=<msgnum>
[Result=<hwnd>]
[WParam=<wparam>]
[LParam=<lparam>]
[Timeout=<secs>]Description
Waits until the specified Windows message is received or until the timeout period has elapsed.Parameters
Message=<msgnum>
- Required. The numeric message identifier to wait for. 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.
Result=<hwnd>
- Optional. A variable to receive the handle of the window that sent the message.
WParam=<wparam>
- Optional. A variable to receive the WParam the sender passed with the message.
LParam=<lparam>
- Optional. A variable to receive the LParam the sender passed with the message.
Timeout=<secs>
- Optional. The number of seconds to wait for the message to arrive before continuing anyway. The TimedOut intrinisic variable can be used to determine whether the wait timed out or not. The default value is zero, usually meaning a timeout will immediately occur.
Remarks
If a Phantom process receives a matching message when the WaitForWindowsMessage is not pending, the message is discarded. For this reason, it is not advisable to use Windows messages for interprocess communication where replies to messages are required. It is possible that the reply message could arrive before the originator of the first message had issued a WaitForWindowsMessage statement and be discarded. A better approach if this is required would be to use the PhantomScript Networking statements to communicate between the processes.Example
WaitForWindowsMessage
Message=WmApp + 1
LParam= lp
Result=hwnd
Timeout=60The above statement waits one minute for the specified message to arrive.