I have added 2 radio buttons on my form. What is the code for checking which radiobuttons are true?
Oh and can you guys please say the code for checking which checkboxes are true? :)
Thanks.
Printable View
I have added 2 radio buttons on my form. What is the code for checking which radiobuttons are true?
Oh and can you guys please say the code for checking which checkboxes are true? :)
Thanks.
You can use
Quote:
IsDlgButtonChecked
The IsDlgButtonChecked function determines whether a button control has a check mark next to it or whether a three-state button control is grayed, checked, or neither.
UINT IsDlgButtonChecked(
HWND hDlg, // handle to dialog box
int nIDButton // button identifier
);
Parameters
hDlg
Handle to the dialog box that contains the button control.
nIDButton
Specifies the integer identifier of the button control.
Return Values
The return value from a button created with the BS_AUTOCHECKBOX, BS_AUTORADIOBUTTON, BS_AUTO3STATE, BS_CHECKBOX, BS_RADIOBUTTON, or BS_3STATE style can be one of the following:
Value Meaning
BST_CHECKED Button is checked.
BST_INDETERMINATE Button is grayed, indicating an indeterminate state (applies only if the button has the BS_3STATE or BS_AUTO3STATE style).
BST_UNCHECKED Button is unchecked
If the button has any other style, the return value is zero.
Remarks
The IsDlgButtonChecked function sends a BM_GETCHECK message to the specified button control.
Code:if( SendMessage(hwndRadio, BM_GETSTATE, 0, 0) == BST_CHECKED)
// Button is checked