⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlgchangepassword.cpp

📁 这是一个信息管理系统的源代码
💻 CPP
字号:
// DlgChangePassWord.cpp : implementation file
//

#include "stdafx.h"
#include "a1.h"
#include "DlgChangePassWord.h"
#include "Crypt.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif  


/////////////////////////////////////////////////////////////////////////////
// CDlgChangePassWord dialog


CDlgChangePassWord::CDlgChangePassWord(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgChangePassWord::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgChangePassWord)
	//}}AFX_DATA_INIT
}


void CDlgChangePassWord::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgChangePassWord)
	DDX_Control(pDX, IDC_EDIT_MM2, m_editMM2);
	DDX_Control(pDX, IDC_EDIT_MM1, m_editMM1);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgChangePassWord, CDialog)
	//{{AFX_MSG_MAP(CDlgChangePassWord)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgChangePassWord message handlers

void CDlgChangePassWord::OnOK() 
{
	CString sMM1;
	CString sMM2;
	m_editMM1.GetWindowText(sMM1);
	m_editMM2.GetWindowText(sMM2);
	if(sMM1!=sMM2)
	{
		MessageBox("请确认密码相同","医药管理系统");
		m_editMM2.SetFocus();

		return;
	}
	else
	{
		try{
			CString sql;
			CA1App * app=(CA1App*)AfxGetApp();
			sMM2=CCrypt::Encrypt(sMM2);
			sql.Format("update tabpurview set admi_password ='%s' where admi_name='%s'",
				sMM2,app->m_sUserName);
			m_runsql.RunSQL(sql);
		}
		catch(_com_error& e)
		{
			AfxMessageBox(e.ErrorMessage());
			return ;	
		}
			MessageBox("成功修改密码!","医药管理系统");

	}
	CDialog::OnOK();
}

BOOL CDlgChangePassWord::PreTranslateMessage(MSG* pMsg) 
{

	if(pMsg->wParam==13&&pMsg->message==WM_KEYDOWN)
	{
			if(SetTheFocus())
				return true;
	}

	return CDialog::PreTranslateMessage(pMsg);
}

BOOL CDlgChangePassWord::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
this->m_editMM1.SetFocus();		
	return false;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

bool CDlgChangePassWord::SetTheFocus()
{
	HWND hwnd=::GetFocus();
	UINT id=::GetDlgCtrlID(hwnd);
	switch(id)
	{
	case IDC_EDIT_MM1:
		this->m_editMM2.SetFocus();
		::PostMessage(m_editMM2.GetSafeHwnd(),WM_KEYDOWN,VK_END,0);
		return true;
	case IDC_EDIT_MM2:
		this->GetDlgItem(IDOK)->SetFocus();
		return true;
	case IDOK:
		this->OnOK();
		return true;
	case IDCANCEL:
		this->OnCancel();
		return true;
	}
	return false;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -