贵阳网站建设-中国互联,厦门响应式网站,专业做网站开发费用,wordpress 网盘 插件新建一个login工程项目对话框#xff0c;主对话框IDD_LOGIN_DIALOG中一个显示按钮IDC_BUTTON1、一个密码按钮IDC_BUTTON2。添加一个密码对话框IDD_DIALOG1#xff0c;添加类password#xff0c;在对话框中添加一个编辑框IDC_EDIT1、一个确定按钮IDC_BUTTON1。 程序功能…新建一个login工程项目对话框主对话框IDD_LOGIN_DIALOG中一个显示按钮IDC_BUTTON1、一个密码按钮IDC_BUTTON2。添加一个密码对话框IDD_DIALOG1添加类password在对话框中添加一个编辑框IDC_EDIT1、一个确定按钮IDC_BUTTON1。 程序功能运行程序显示按钮灰色不可用点击密码按钮弹出密码对话框在编辑框中输入WHCC点击确定按钮显示按钮可用。 主要代码如下 l1、oginDlg.cpp中
BOOL CLoginDlg::OnInitDialog()
{CDialog::OnInitDialog();...GetDlgItem(IDC_BUTTON1)-EnableWindow(false);return TRUE; // return TRUE unless you set the focus to a control
}void CLoginDlg::OnButton1()
{// TODO: Add your control notification handler code hereAfxMessageBox(按钮可用);
}void CLoginDlg::OnButton2()
{// TODO: Add your control notification handler code herepassword dlg;dlg.DoModal();CString passdlg.LOGIN;if (passWHCC) {GetDlgItem(IDC_BUTTON1)-EnableWindow(true);}else{GetDlgItem(IDC_BUTTON1)-EnableWindow(false);}}2、password.h中添加一个公共变量
class password : public CDialog
{
// Construction
public:password(CWnd* pParent NULL); // standard constructorCString LOGIN;...
}3、
void password::OnButton1()
{// TODO: Add your control notification handler code hereGetDlgItem(IDC_EDIT1)-GetWindowText(LOGIN);if (LOGINWHCC){UpdateData(false);EndDialog(0);}else{MessageBox(输入密码有误!);GetDlgItem(IDC_EDIT1)-SetFocus();}}运行程序 源码下载