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

📄 modifydlg.cpp

📁 通讯录管理系统1.0 可以为您方便地, 安全地管理你的通讯录, 是您的家庭好帮手. 本系统使用Visual C++(MFC)开发, ODBC开放式数据库源
💻 CPP
字号:
// ModifyDlg.cpp : implementation file
//

#include "stdafx.h"
#include "SGAdrLstMS.h"
#include "ModifyDlg.h"
#include "SysRecordSet.h"

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

/////////////////////////////////////////////////////////////////////////////
// CModifyDlg dialog


CModifyDlg::CModifyDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CModifyDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CModifyDlg)
	m_newtel = _T("");
	m_newqq = _T("");
	m_newmobile = _T("");
	m_newemail = _T("");
	m_newbak = _T("");
	m_modifyname = _T("");
	//}}AFX_DATA_INIT
}


void CModifyDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CModifyDlg)
	DDX_Text(pDX, IDC_NEWTEL, m_newtel);
	DDX_Text(pDX, IDC_NEWQQ, m_newqq);
	DDX_Text(pDX, IDC_NEWMOBILE, m_newmobile);
	DDX_Text(pDX, IDC_NEWEMAIL, m_newemail);
	DDX_Text(pDX, IDC_NEWBAK, m_newbak);
	DDX_Text(pDX, IDC_MODIFYNAME, m_modifyname);
	DDV_MaxChars(pDX, m_modifyname, 255);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CModifyDlg, CDialog)
	//{{AFX_MSG_MAP(CModifyDlg)
	ON_WM_SHOWWINDOW()
	ON_BN_CLICKED(IDC_SURE, OnSure)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CModifyDlg message handlers

void CModifyDlg::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);
	

	this->GetDlgItem(IDC_MODIFYNAME)->SetFocus();
}

void CModifyDlg::OnSure() 
{

	db.RefreshConnection();
	db.Open();	
	db.MoveFirst();

	this->UpdateData(true);
	if (this->m_modifyname == "")
	{
		MessageBox("必须输入联系人的姓名","提示",MB_ICONEXCLAMATION);
		this->GetDlgItem(IDC_MODIFYNAME)->SetFocus();
		return;
	}
	this->UpdateData(false);

	while (!db.IsEOF())
	{
		if ( db.m_column2 == this->m_modifyname)
		{
			this->UpdateData(true);

			this->m_newtel = db.m_column3;
			this->m_newmobile = db.m_column4;
			this->m_newemail = db.m_column5;
			this->m_newbak = db.m_column6;
			this->m_newqq = db.m_QQ__;

			this->UpdateData(false);

			this->GetDlgItem(IDC_NEWTEL)->EnableWindow(true);
			this->GetDlgItem(IDC_NEWMOBILE)->EnableWindow(true);
			this->GetDlgItem(IDC_NEWEMAIL)->EnableWindow(true);
			this->GetDlgItem(IDC_NEWBAK)->EnableWindow(true);
			this->GetDlgItem(IDC_NEWQQ)->EnableWindow(true);
			this->GetDlgItem(IDOK)->EnableWindow(true);
			this->GetDlgItem(IDC_MODIFYNAME)->EnableWindow(false);
			this->GetDlgItem(IDC_SURE)->EnableWindow(false);



			break;
		}
		db.MoveNext();
	}	
		
	if (db.IsEOF())
	{
		MessageBox("无此联系人,操作失败","操作失败",MB_ICONSTOP);
		this->GetDlgItem(IDC_MODIFYNAME)->SetFocus();
	}
	db.Close();
}

void CModifyDlg::OnOK() 
{
	UpdateData(true);
	
	CDialog::OnOK();

}

⌨️ 快捷键说明

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