Getting a Check Box's Image in Desktop Windows Applications

Applies to TestComplete 15.47, last modified on January 20, 2023

Note: To learn how to simulate user actions over check box controls in web applications, see Working With Check Box Controls in Web Applications.

While testing check box 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 check box controls you are working with can have images. If you need to get an image, you can obtain it by using the wImage property. This property belongs to the Win32CheckBox object, which is associated with standard Windows check box controls during the test run. The wImage property returns the Picture object that contains the control’s image (for more information about the Picture object, see the Picture Object topic). The code snippet below copies a check box’s image to the clipboard:

JavaScript, JScript

...
bImage = Sys.Process("MyApp").Window("MainWin").Window("MyCheckBox");
Sys.Clipboard = bImage.wImage;
...

Python

...
bImage = Sys.Process("MyApp").Window("MainWin").Window("MyCheckBox")
Sys.Clipboard = bImage.wImage
...

VBScript

...
Set bImage = Sys.Process("MyApp").Window("MainWin").Window("MyCheckBox")
Set Sys.Clipboard = bImage.wImage
...

DelphiScript

...
bImage := Sys.Process('MyApp').Window('MainWin').Window('MyCheckBox');
Sys.Clipboard := bImage.wImage;
...

C++Script, C#Script

...
bImage = Sys["Process"]("MyApp")["Window"]("MainWin")["Window"]("MyCheckBox");
Sys["Clipboard"] = bImage["wImage"];
...

See Also

Working With Check Box Controls in Desktop Windows Applications
wImage Property (CheckBox Controls)
Picture Object
Working With Check Box Controls in Web Applications

Highlight search results