Share this page

# rdp_get_window_position

Retrieves the position of a window.

Synchronization Functions

int rdp_get_window_position( "StepDescription=<step_description>", "Snapshot=<snapshot>", ["ConnectionID=<connection_identifier>",] ["WindowTitle[/RE]=<window_title>",] ["WindowOrdinal=<window_ordinal>",] "WindowLeft=<left_border_param>", "WindowTop=<upper_border_param >", "WindowWidth=<win_width_param>", "WindowHeight=<win_height_param>", RDP_LAST );

This function returns LR_PASS (0) on success or LR_FAIL (1) on failure. Note that LR_PASS and LR_FAIL generally indicate whether the function call completed without an exception, and not that the test step succeeded.

All string arguments (char type) can be parameterized using standard parameterization.

Argument | Description
--- | ---
StepDescription | A descriptive, unique name for this step. Use any text.
Snapshot | The name of the snapshot file of the screen state before this step.
ConnectionID | The name of the connection on which this function operates. Do not change the recorded ID. If several connections are open and the ID is not specified, the first connection in the script is used. If only one connection is open, the connection ID is not required.
"WindowTitle=" "WindowTitle/RE=" | The title of the window. The value for Title is a literal string, for example, `"Title=Quality Center"`. If you use WindowTitle/RE, the value is a regular expression, for example, `"WindowTitle/RE=^Document[0-9]+ - Microsoft Word"`.
WindowOrdinal | The 1-based index of the window among the session windows that match the title specified by WindowTitle or WindowTitle/RE. For example, if the WindowTitle/RE and WindowOrdinal arguments are `"WindowTitle/RE=Document[0-9]+ - Microsoft Word"` and `"WindowOrdinal=3"`, the window specified is the third window in the creation order of the existing windows whose title matches the regular expression `"Document[0-9]+ - Microsoft Word"`. If this optional argument is omitted, the default value is 1.
WindowLeft | An output parameter for the left border of the specified window.
WindowTop | An output parameter for the top border of the specified window.
WindowWidth | An output parameter for the width of the specified window.
WindowHeight | An output parameter for the height of the specified window.
RDP_LAST | The delimiter marking the end of the argument list.

The rdp_get_window_position function retrieves the position and size of a window according to its title. If the window title is omitted, the function returns the position of the active window (not focused).

This function requires that an RDP agent be installed on the RDP Server.

## Example

The following demonstrates how to retrieve the window position for a Notepad window. The position and size of the window are saved in the ParamX, ParamY, ParamWidth, and ParamHeight output parameters.

rdp_get_window_position (

"StepDescription=Get Window Position 1",

"Snapshot=snapshot1.inf",

"WindowTitle=Notepad",

"WindowLeft=ParamX",

"WindowTop=ParamY",

"WindowWidth=ParamWidth",

"WindowHeight=ParamHeight",

RDP_LAST );

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: