BOOL CTMSDlg::OnInitDialog() { ...... ...... //设置窗口焦点,注意return TRUE 改成 return FALSE GetDlgItem(IDC_EDIT_USERNAME)->SetFocus(); return FALSE; }