CEdit *pEditUser=NULL; pEditUser=(CEdit *)GetDlgItem(IDC_EDIT_OLDNAME); //获取文本框指针 pEditUser->SetReadOnly(TRUE); //设置为只读状态