Obtaining the Number of Links in SysLink Controls in Desktop Windows Applications

Applies to TestComplete 15.46, last modified on January 09, 2023

While testing SysLink controls, you can use specific properties and methods of the corresponding program object to perform certain actions and obtain data stored in controls. You can call these methods and properties from your keyword tests, as well as from scripts. This topic describes how to work with the needed properties and methods from your scripts. However, when testing a control from your keyword test, you can use the same methods and properties calling them from keyword test operations. For more information, see Keyword Tests Basic Operations.

The SysLink control can contain several links. To obtain the total number of links the control contains, use the LinkCount property of the Win32SysLink object. TestComplete associates this object with all SysLink controls whose class names are listed in the Object Mapping options of your project.

The example below demonstrates how you can get the total number of links stored in the SysLink control that is located on the About Windows window (to invoke this window, select Help | About Windows from the main menu of the Windows Explorer):

JavaScript, JScript

function main()
{
  var SysLink, SysLinkItem;
    
  // Obtain the SysLink control
  SysLink = Sys.Process("Explorer").Window("#32770", "About Windows", 1).Window("SysLink", "", 1);
  
  // Get the number of links
  Log.Message (SysLink.LinkCount);
}

Python

def Main():
    
  # Obtain the SysLink control
  SysLink = Sys.Process("Explorer").Window("#32770", "About Windows", 1).Window("SysLink", "", 1)
  
  # Get the number of links
  Log.Message (SysLink.LinkCount)

VBScript

Sub main
  Dim SysLink, SysLinkItem
    
  ' Obtain the SysLink control
  Set SysLink = Sys.Process("Explorer").Window("#32770", "About Windows", 1).Window("SysLink", "", 1)

  ' Get the number of links
  Log.Message SysLink.LinkCount
End Sub

DelphiScript

procedure main;
var SysLink, SysLinkItem;
begin

  // Obtain the SysLink control
  SysLink := Sys.Process('Explorer').Window('#32770', 'About Windows', 1).Window('SysLink', '', 1);
  
  // Get the number of links
  Log.Message (SysLink.LinkCount);
end;

C++Script, C#Script

function main()
{
  var SysLink, SysLinkItem;
    
  // Obtain the SysLink control
  SysLink = Sys["Process"]("Explorer")["Window"]("#32770", "About Windows", 1)["Window"]("SysLink", "", 1);
  
  // Get the number of links
  Log.Message(SysLink["LinkCount"]);
}

See Also

Working With SysLink Controls in Desktop Windows Applications
LinkCount Property (SysLink Controls)

Highlight search results