CitrixWaitForWindowSize Function


This function waits until a window has a specified size. This function is used to synchronize subsequent user input after a window has been resized 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



CitrixWaitForWindowSize( in nWindow  : number,
                         in nWidth   : number,
                         in nHeight  : 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.
nWidth The window must have this width to satisfy the function.
nHeight The window must have this height to satisfy the function.
nTimeout Specifies the time in milliseconds to wait for the window to reach the correct size (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.


  transaction TMain
    CitrixInit(640, 480);
    CitrixConnect("myserver", "myusername", "mypass", "mydomain", COLOR_16bit);
    hWnd6 := CitrixWaitForWindowCreation("ICA Seamless Host Agent", MATCH_Exact, 0x94C800C4, 0, 0, 390, 223);
    CitrixWaitForWindow(hWnd6, EVENT_Activate);
    CitrixWaitForWindowCreation("Program Manager");
    CitrixMouseClick(182, 195, hWnd6, MOUSE_ButtonLeft);
    CitrixWaitForWindow(hWnd6, EVENT_Destroy);
    CitrixMouseDblClick(38, 22, DESKTOP, MOUSE_ButtonLeft);
    hWnd8 := CitrixWaitForWindowCreation("My Documents", MATCH_Exact, 0x16CF0000, 285, 31, 268, 205);
    CitrixWaitForWindow(hWnd8, EVENT_Activate);
    CitrixMouseClick(234, 11, hWnd8, MOUSE_ButtonLeft);
    CitrixWaitForWindowPos(hWnd8, -4, -4);
    CitrixWaitForWindowSize(hWnd8, 648, 460);
    CitrixMouseClick(614, 12, hWnd8, MOUSE_ButtonLeft);
    CitrixWaitForWindowRestore(hWnd8, -4, -4, 648, 460);
    CitrixWaitForWindowPos(hWnd8, 285, 31);
    CitrixWaitForWindowSize(hWnd8, 268, 205);
    CitrixMouseClick(258, 13, hWnd8, MOUSE_ButtonLeft);
    CitrixWaitForWindow(hWnd8, EVENT_Destroy);
  end TMain;