//利用default button void CDlgAddTest::OnOK() { if(GetFocus()->m_hWnd== GetDlgItem(IDOK)->m_hWnd){ MessageBox("stoped at ok."); } else{ GetNextDlgTabItem(GetFocus())->SetFocus(); } //CDialog::OnOK(); }