ctrx_window_move_by_id

Example

Moves the specified window.

int ctrx_window_move_by_id(long window_id, long nx, long ny, int isRelative, CTRX_LAST )

window_idA unique window ID, returned by a function such as ctrx_get_window_id_by_order.
nx
  • When isRelative is set to COORDINATE_SYSTEM_ABSOLUTE, the left margin of the window is moved to this X coordinate.
  • When isRelative is set to COORDINATE_SYSTEM_RELATIVE, the window is moved horizontally nX pixels. If nX is set to a negative value, the window moves left. If nX is set to a positive value, the window moves right.
ny
  • When isRelative is set to COORDINATE_SYSTEM_ABSOLUTE, the top margin of the window is moved to this Y coordinate.
  • When isRelative is set to COORDINATE_SYSTEM_RELATIVE, the window is moved vertically nY pixels. If nY is set to a negative value, the window moves up. If nX is set to a positive value, the window moves down.
isRelative

Specifies whether the nX and nY parameters are interpreted as absolute coordinates or as a move vector. Possible values:

  • COORDINATE_SYSTEM_ABSOLUTE (interpret parameters as absolute coordinates)
  • COORDINATE_SYSTEM_RELATIVE (interpret parameters as move vector)
CTRX_LASTA marker that indicates the end of the argument list.

Return Values

If the function succeeds, it returns E_OK. Otherwise, it returns E_GENERAL_ERROR or E_DISCONNECTED.

Parameterization

Parameterization is not available for this function.

Example

In the following example, the ctrx_get_window_id_by_order function searches for the topmost window in the stack (in position 0). It returns the numeric identifier of the window. The ctrx_window_move_by_id function moves the window randomly ten times up down left right 50 pixels.

Copy code
int I;
long windowID, x, y;

windowID = ctrx_get_window_id_by_order(0);
for(i=0 ;i<10;i++)
{
        x = rand() % 100 - 50;
        y = rand() % 100 - 50;
        ctrx_window_move_by_id(windowID, x, y, COORDINATE_SYSTEM_RELATIVE);  
        lr_think_time(3);
}