I am using Visual C++ 2010 Express (that doesn't have MFC). Despite that, I have been able to create a Dialog box and populate the fields (and hopefully, soon, read back some data).
I now want to use some radio buttons.
To that end I have created two buttons with BS_AUTORADIOBUTTON as a group.
I cannot set one button active using CheckRadioButton, and if I use the form and click on the OK button, IsDlgButtonChecked returns zero no matter which button is checked.
if ((IsChecked = IsDlgButtonChecked(hDlg, IDM_SPUPD)) == BST_CHECKED)
{
fprintf(fp1, "Ischecked UPD (%d)\n", IsChecked);
fflush(fp1);
}
else
{
fprintf(fp1, "Is NOT checked UPD(%d)\n", IsChecked);
fflush(fp1);
}
File fp1 is my debug trace file - no matter which button is clicked I ALWAYS get the "Is NOT checked" response.
The button definitions are
CONTROL " Add", 343, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 89, 251, 32, 12
CONTROL " Update", 344, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 191, 251, 39, 12
Can someone suggest why this is not working, and if this is wrong, what I should be using?