CheckRadioButton function (winuser.h)

Adds a check mark to (checks) a specified radio button in a group and removes a check mark from (clears) all other radio buttons in the group.

Syntax

BOOL CheckRadioButton(
  [in] HWND hDlg,
  [in] int  nIDFirstButton,
  [in] int  nIDLastButton,
  [in] int  nIDCheckButton
);

Parameters

[in] hDlg

Type: HWND

A handle to the dialog box that contains the radio button.

[in] nIDFirstButton

Type: int

The identifier of the first radio button in the group.

[in] nIDLastButton

Type: int

The identifier of the last radio button in the group.

[in] nIDCheckButton

Type: int

The identifier of the radio button to select.

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 CheckRadioButton function sends a BM_SETCHECK message to each of the radio buttons in the indicated group.

The nIDFirstButton and nIDLastButton parameters specify a range of button identifiers (normally the resource IDs of the buttons). The position of buttons in the tab order is irrelevant; if a button forms part of a group, but has an ID outside the specified range, it is not affected by this call.

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-2 (introduced in Windows 10, version 10.0.10240)

See also

CheckDlgButton

IsDlgButtonChecked

Reference