CitrixGetWindow Function

Action

This function returns the specified window of the currently tracked window stack. The nOrder parameter specifies which window is to be returned. If the function succeeds, a window handle that can be used as the nWindow parameter in Citrix functions is returned.

Include file

CitrixAPI.bdh

Syntax

CitrixGetWindow( in nOrder : number ): number;

Return value

  • > 0 if the function succeeds

  • 0 otherwise

Parameter Description
nOrder

Specifies one of the following values:

  • 0 For the top-most window.

  • >0 Specifies the position of the window in relation to the top-most window (e.g., “2” is the 3rd position).

  • -1 Specifies the active window (the top-most window may be a different window).

  • -2 Specifies the bottom-most window.

Example:

  transaction TMain
  var
    sWindowCaption : string;
    nWindowHandle  : number;
    i              : number;
  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");
    CitrixMouseClick(182, 195, hWnd6, MOUSE_ButtonLeft);
    CitrixWaitForWindow(hWnd6, EVENT_Destroy);
    ThinkTime(2.78);
    CitrixMouseDblClick(38, 22, DESKTOP, MOUSE_ButtonLeft);
    hWnd8 := CitrixWaitForWindowCreation("My Documents", MATCH_Exact, 0x16CF0000, 285, 31, 268, 205);
    CitrixWaitForWindow(hWnd8, EVENT_Activate);
    i := 0;
    nWindowHandle := CitrixGetWindow(i);
    while (nWindowHandle > 0) do
      CitrixGetWindowCaption(nWindowHandle, sWindowCaption);
      print("window " + string(nWindowHandle) + ": " + sWindowCaption);
      i := i + 1;
      nWindowHandle := CitrixGetWindow(i);
    end;
    CitrixMouseClick(258, 13, hWnd8, MOUSE_ButtonLeft);
    CitrixWaitForWindow(hWnd8, EVENT_Destroy);
    CitrixDisconnect();
  end TMain;