CitrixAddInterrupt Function

Action

Adds an interrupt specification. On certain window events (creations, activations, destructions, and caption changes) all stored interrupt specifications are checked; when an interrupt specification matches an occurred event, then an interrupt is thrown. Interrupts may be handled by a Citrix event handler. For further information see the event-handler section.

Include file

CitrixAPI.bdh

Syntax

CitrixAddInterrupt( in nReason  : number,
                    in sCaption : string allownull,
                    in nMatch   : number,
                    in nWindow  : number optional): boolean;

Return value

  • true if the function succeeds

  • false otherwise

Parameter Description
nReason
  • INTERRUPT_WindowCreate: An interrupt is triggered if a created window matches the specified conditions.

  • INTERRUPT_WindowActivate: An interrupt is triggered if an activated window matches the specified conditions.

  • INTERRUPT_WindowDestroy: An interrupt is triggered if a destroyed window matches the specified conditions.

  • INTERRUPT_CaptionChange: An interrupt is triggered if a changed window caption matches the specified window caption (specified in the nMatch parameter) or the window with the nWindow ID changes its caption.

sCaption The caption that triggers an interrupt if it matches the window caption (which is specified in the nMatch parameter). If this parameter is provided (and not null or “”) then the nWindow parameter will be ignored.
nMatch

Specifies one of the following values:

  • MATCH_Exact (default): Case-sensitive comparison.
  • MATCH_ExactNoCase: Case-insensitive comparison.
  • MATCH_Wildcard: The search string must either begin or end with a '*' character, which matches everything. The rest of the string is compared case sensitively.
  • MATCH_WildcardNoCase: The search string must either begin or end with a '*' character, which matches everything. The rest of the string is compared case insensitively.
  • MATCH_RegExp: The search string is a regular expression. See the regular expression chapter for a description of Silk Performer's regular expression capability.
nWindow If the sCaption parameter is not provided, then windows will be examined by comparing their ID’s against the nWindow parameter (optional).

Example

transaction TMain
  var
  begin
    CitrixInit(800, 600);
    CitrixAddInterrupt(INTERRUPT_WindowCreate, "ICA Seamless Host Agent", MATCH_Exact);
    CitrixConnect("lab74", "labadmin", "labpass", "testlab1", COLOR_16bit);
    CitrixWaitForLogon();
    hWnd4 := CitrixWaitForWindowCreation("", MATCH_Exact, 0x96840000, -2, 572, 804, 30);
    CitrixWaitForWindowCreation("Program Manager");
    CitrixMouseClick(36, 17, hWnd4, MOUSE_ButtonLeft, MOD_None, -1, 0);
    hWnd11 := CitrixWaitForWindowCreation("", MATCH_Exact, 0x96400000, 2, 313, 163, 263);
    CitrixMouseClick(62, 247, hWnd11, MOUSE_ButtonLeft);
    CitrixWaitForWindow(hWnd11, EVENT_Destroy);
    hWnd12 := CitrixWaitForWindowCreation("Shut Down Windows", MATCH_Exact, 0x94C808CC, 191, 136, 417, 192);
    CitrixWaitForWindow(hWnd12, EVENT_Activate);
    CitrixMouseClick(203, 170, hWnd12, MOUSE_ButtonLeft);
    CitrixWaitForDisconnect();
  end TMain;
dclevent
  handler Handler1 <EVENT_CITRIXINTERRUPT>
  var
    nInterrupt, nWindow : number;
    nStyle              : number;
  begin
    CitrixGetActInterrupt(nInterrupt, nWindow);

    ErrorAdd(FACILITY_CITRIXENGINE, 47, SEVERITY_INFORMATIONAL);
    print(string(nWindow));
    if CitrixGetWindowStyle(nWindow, nStyle) and (nStyle <> 0xB4000000) then
      CitrixWaitForWindow(nWindow, EVENT_Activate);
      CitrixMouseClick(201, 202, nWindow, MOUSE_ButtonLeft);
      CitrixWaitForWindow(nWindow, EVENT_Destroy);
    end;
    ErrorRemove(FACILITY_CITRIXENGINE, 47);

  end Handler1;