LRESULT CXTPTaskDialogFrame::OnDialogClickRadioButton(WPARAM wParam, LPARAM /*lParam*/) { CButton* pWnd = DYNAMIC_DOWNCAST(CButton, GetDlgItem((UINT)wParam)); if (!pWnd) return FALSE; if ((pWnd->SendMessage(WM_GETDLGCODE) & DLGC_RADIOBUTTON) == 0) return FALSE; HWND hWndCtrl = ::GetWindow(m_hWnd, GW_CHILD); while (hWndCtrl) { if (::SendMessage(hWndCtrl, WM_GETDLGCODE, 0, 0L) & DLGC_RADIOBUTTON) { ::SendMessage(hWndCtrl, BM_SETCHECK, hWndCtrl == pWnd->GetSafeHwnd(), 0L); } hWndCtrl = ::GetWindow(hWndCtrl, GW_HWNDNEXT); } m_nSelRadioButtonID = (UINT)wParam; SendNotify(TDN_RADIO_BUTTON_CLICKED, (WPARAM)m_nSelRadioButtonID); return TRUE; }
CBaseDialog::~CBaseDialog() { POSITION pos= m_wndList.GetHeadPosition(); CButton* pBtn = NULL; while (pos) { pBtn = (CButton*)m_wndList.GetNext(pos); if (pBtn->GetSafeHwnd() != NULL) { pBtn->UnsubclassWindow(); } delete pBtn; } m_wndList.RemoveAll(); }
BOOL CServerGUIDlg::OnInitDialog() { CDialogEx::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here CButton *pButton = (CButton *)GetDlgItem(BTN_START_SERVER); if (pButton && pButton->GetSafeHwnd()) { pButton->SetIcon((HICON)LoadImage(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(ID_START), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR)); } serverStatus = false; ms = new MessageSocket((CEdit*) GetDlgItem(EC_SERVER_STATUS)); return TRUE; // return TRUE unless you set the focus to a control }