<p>When I'm initializing a dialog, I'd like to select one of the radio buttons on the form.  I don't see a way to associate a Control variable using the Class Wizard, like you would typically do with CButtons, CComboBoxes, etc...</p>

<p>Further, it doesn't like a CRadioButton class even exists.</p>

<p>How can I select one of the several radio buttons?</p>

[{'answer_id': 73531, 'author': 'moswald', 'author_id': 8368, 'author_profile': 'https://Stackoverflow.com/users/8368', 'pm_score': 4, 'selected': True, 'text': '<p>Radio buttons and check buttons are just buttons.  Use a <code>CButton</code> control and use <code>GetCheck</code>/<code>SetCheck</code>.</p>\n'}, {'answer_id': 73559, 'author': 'Chris Karcher', 'author_id': 2773, 'author_profile': 'https://Stackoverflow.com/users/2773', 'pm_score': 3, 'selected': False, 'text': '<p>Going on what mos said, the following worked did the trick:</p>\n\n<pre><code>CButton* pButton = (CButton*)GetDlgItem(IDC_RADIOBUTTON);\npButton-&gt;SetCheck(true);\n</code></pre>\n'}, {'answer_id': 73588, 'author': 'ChrisN', 'author_id': 3853, 'author_profile': 'https://Stackoverflow.com/users/3853', 'pm_score': 4, 'selected': False, 'text': '<p>Use <a href="https://learn.microsoft.com/en-us/cpp/mfc/reference/cwnd-class?view=msvc-160#checkradiobutton" rel="nofollow noreferrer">CWnd::CheckRadioButton</a> to set select one button in a group and <a href="https://learn.microsoft.com/en-us/cpp/mfc/reference/cwnd-class?view=msvc-160#getcheckedradiobutton" rel="nofollow noreferrer">CWnd::GetCheckedRadioButton</a> to retrieve the ID of the selected button. Be sure to call these methods on your dialog object, and not any of the radio button objects.</p>\n'}, {'answer_id': 9307754, 'author': 'Gargo', 'author_id': 1213334, 'author_profile': 'https://Stackoverflow.com/users/1213334', 'pm_score': 1, 'selected': False, 'text': '<pre><code>void CMyDlg::DoDataExchange(CDataExchange* pDX)\n{\n  ...\n  DDX_Radio(pDX, IDC_RADIO1, m_Radio);\n  ...\n}\n</code></pre>\n\n<p>but it is the same thing Wizard generates</p>\n'}, {'answer_id': 46086524, 'author': 'sailfish009', 'author_id': 7404323, 'author_profile': 'https://Stackoverflow.com/users/7404323', 'pm_score': 1, 'selected': False, 'text': '<p>You can use this one-liner:</p>\n\n<pre><code>::SendMessage(GetDlgItem(IDC_RADIO1)-&gt;m_hWnd, BM_SETCHECK, BST_CHECKED, NULL);\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/73498', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2773/']