> when the dialogue box closes
That statement is ambigious. If you mean inside the dialog in the WM_CLOSE handler you would do something like this:
// WM_CLOSE message handler
void MainDlg::OnClose()
{
int iVal = -1;
CButton* pBtn = dynamic_cast<CButton*>(GetDlgItem(IDC_BGREY));
if ( pBtn)
iVal = pBtn->GetCheck();
TRACE("Radio.getCheck returned: %d\r\n", iVal);
CDialog::OnClose();
}
If you mean from the caller code that created the dialog you would do something like this:
// public member function
int MainDlg::getRadioCheck(UINT id)
{
int nret = -1; // failed to find control 'id'
CButton* pBtn = dynamic_cast<CButton*>(GetDlgItem(id));
if ( pBtn)
nret = pBtn->GetCheck();
return nret;
}
// now in the callers code
void MyFrame::showTestDlg(){
MainDlg dlg;
if ( IDOK == dlg.DoModal()){
TRACE("MainDlg.radioValue is %d\r\n",
dlg.getRadioCheck( IDC_BGREY));
}
}
Hope this helps
-pete