注册模块
注册模块
控件ID |
控件属性 |
对应变量 |
3个IDC_STATIC |
用户名,密码,重复密码 |
|
IDC_EDIT_name |
Visible |
CString m_Name |
IDC_EDIT_pwd |
Password |
CString m_Pwd |
IDC_EDIT_pwd1 |
Password |
CString m_Pwd1 |
IDC_BUTTON_OK |
提交 |
|
IDC_BUTTON_reset |
重置 |
提交 处理函数OnOK();
UpdateData(); if (m_Name.IsEmpty()||m_Pwd.IsEmpty()||m_Pwd1.IsEmpty()) { AfxMessageBox(_T("用户名密码不能为空")); return; } if (m_Pwd != m_Pwd1) { AfxMessageBox(_T("密码不一致")); return; } //此处查找数据表中是否用户名重复(TODO) if ((m_Name == _T("admin")) && (m_Pwd == _T("123")) && (m_Pwd1 == _T("123")) ) { //如果为空,就往数据表中插入用户名,密码,权限信息(默认为0)(TODO) AfxMessageBox(_T("注册成功")); CDialogEx::OnOK(); } else { AfxMessageBox(_T("用户名已存在")); return; }
重置 处理函数OnReset
m_Name = ""; m_Pwd = ""; m_Pwd1 = ""; UpdateData(false);
待完善
Best Regards To Reader:
==============================================
Royal Kao(高全宁)
Mob: 13771921045
Mail: gaoquanning@163.com
Blog: http://www.cnblogs.com/gaoquanning/
==============================================