Phantom Documentation

[Help Home] [Phantom Home]

void window.SetHandle(int)

Applicable Classes: All

Return Type: void
Parameters: int Handle


SetHandle sets the numeric handle for the window. There are two ways a window can be identified; through a class and a tag hierarchy (window declarations), or through a numeric handle (also known as HWND). A numeric handle can be used if the tag or class is changing throughout the run.

The new handle must be a valid window handle. If it is not, and the script uses the window, it will produce an error. Generally, the Handle passed to this function is obtained by using the GetHandle function on a window using window declarations. This ensures that the handle is valid. Note that a window handle is not constant between instances of an application. Therefore, each time the target application is started, or the target window is instantiated, a new window handle will have to be retrieved using GetHandle. If the window is closed, and a window with a Handle tries to access it, an error will be produced.

Note also that functions such as GetChild, GetParent, GetTopParent, GetNextSibling
, and GetPrevSibling all return windows with handles, not window declarations. If these functions return a 'null' window, it is a window with a handle of 0.

For an example of this function, see the GetHandle function.

See Also: GetHandle

Copyright 2000-2011 Phantom Automated Solutions