CitrixWaitForWindowPos Function

Action

This function waits until a window has a specified position. This function is used to synchronize subsequent user input after a window has been moved through a user action (e.g. a mouse drag).

In the case of a timeout, error reporting can be prohibited with the bNoError parameter.

Include file

CitrixAPI.bdh

Syntax

CitrixWaitForWindowPos( in nWindow  : number,
                        in nX       : number,
                        in nY       : number,
                        in nTimeout : number optional,
                        in bNoError : boolean optional ) : boolean

Return value

  • true if successful

  • false otherwise

Parameter Description
nWindow Window handle returned by a call to CitrixWaitForWindowCreation. Use DESKTOP to specify a region relative to the desktop.
nX X coordinate to which the left margin of the window must be moved to satisfy the function.
nY Y coordinate to which the left top margin of the window must be moved to satisfy the function.
nTimeout Specifies the time in milliseconds to wait for the window to move to the correct position (optional). When this parameter is omitted or set to 0, the default timeout is used. The default value can be adjusted by profile settings ( Settings > Active Profile > Citrix > General > Synchronization timeout ) or an appropriate call to the CitrixSetOption function.
bNoError Set this parameter to true to prevent a timeout from raising an error. This is especially useful for controlling variable user reactions.

Example:

  transaction TMain
  var
  begin
    CitrixInit(640, 480);
    CitrixConnect("myserver", "myusername", "mypass", "mydomain", COLOR_16bit);
    CitrixWaitForLogon();
    hWnd6 := CitrixWaitForWindowCreation("ICA Seamless Host Agent", MATCH_Exact, 0x94C800C4, 0, 0, 390, 223);
    CitrixWaitForWindow(hWnd6, EVENT_Activate);
    CitrixWaitForWindowCreation("Program Manager");
    CitrixMouseButtonDown(163, 12, hWnd6, MOUSE_ButtonLeft);
    CitrixMouseButtonUp(289, 54, false, DESKTOP, MOUSE_ButtonLeft);
    CitrixWaitForWindow(hWnd6,EVENT_Activate);
    CitrixWaitForWindowPos(hWnd6, 126, 42);
    CitrixMouseClick(187, 203, hWnd6, MOUSE_ButtonLeft);
    CitrixWaitForWindow(hWnd6, EVENT_Destroy);
    ThinkTime(2.63);
    CitrixDisconnect();
  end TMain;