CheckDlgButton function (winuser.h)

Changes the check state of a button control.

Syntax

BOOL CheckDlgButton(
  [in] HWND hDlg,
  [in] int  nIDButton,
  [in] UINT uCheck
);

Parameters

[in] hDlg

Type: HWND

A handle to the dialog box that contains the button.

[in] nIDButton

Type: int

The identifier of the button to modify.

[in] uCheck

Type: UINT

The check state of the button. This parameter can be one of the following values.

Value Meaning
BST_CHECKED
Sets the button state to checked.
BST_INDETERMINATE
Sets the button state to grayed, indicating an indeterminate state. Use this value only if the button has the BS_3STATE or BS_AUTO3STATE style.
BST_UNCHECKED
Sets the button state to cleared

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The CheckDlgButton function sends a BM_SETCHECK message to the specified button control in the specified dialog box.

Examples

For an example, see Creating a Modeless Dialog Box in Using Dialog Boxes.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-dialogbox-l1-1-0 (introduced in Windows 8)

See also

CheckRadioButton

IsDlgButtonChecked

Reference