Home > Language Reference > Windows Management Functions > CheckedW


The CheckedW function returns the check state of the specified checkbox or radio button.


Used to know if a check box is checked or not, and with an If...EndIf block execute different pieces of code depending if it is checked or not.


ret=CheckedW(<window_name> [, <control_text>])


<window_name>, string, name of the window contaning the specified control. If the specified control is displayed within a parent window, <window_name> is the name of the parent window and <control_text> must be specified.

<control_text>, optional, string, text of the control as seen by the user (case sensitive).

Return value

ret, integer. If the specified check box or radio button is checked, the return value is 1 ; if it is unchecked, the return value is 0. If the control is not recognized as a checkbox or radio button, or if the window name does not exist, the return value is -1.


To generate <control_text> parameter, use Recording mode and record the action check/uncheck the checkbox control that you want to test. Stop Recording mode and in the generated ChooseItem line, copy/paste the <control_text> parameter.

CheckedW function does not wait until the control is there, it makes the check immediately, so you have to wait that the window <window_name> is really displayed before running CheckedW (see UseWindow function).

CheckedW function truncates the <window_name> and tries to find an approaching window. To force an exact recognition of the window, use #UseExact =1 (see the example below).

As a checkbox or a radio button can have three states (Checked, Enabled, Hidden), the table below gives the return code of the three WinTask x64 functions which deal with this kind of control, ExistWEnabledW and CheckedW:

 Control Checked  Control Enabled  Control Hidden  ExistW return code EnabledW return code   CheckedW return code
 0      0  0  1  0  0
 0  0  1  0  0  -1
 0  1  0  1  1  0
 1  0  0  1  0  1
 0  1  1  0  0  -1
 1  0  1  0  0  -1
 1  1  0  1  1  1
 1  1  1  0  0  -1


See also



'Test a checkbox state in the Notepad Find window

UseWindow("NOTEPAD.EXE|Edit|Untitled - Notepad|1",1)

UseWindow("NOTEPAD.EXE|Notepad|Untitled - Notepad",1)
 ChooseMenu(Normal,"&Edit|&Find... Ctrl+F")
#UseExact=1  'Force a window exact recognition
'Is Match case checkbox checked ?
pause 3    'During the Pause, check or uncheck the checkbox and see the 2 possible values for CheckedW
ret=CheckedW("NOTEPAD.EXE|Button|Match &case")