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

📄 cnfmuserdlg.cpp

📁 类似于QQ的聊天工具,分为客户端和服务器端,有共享空间,能发布公告,可传输文件
💻 CPP
字号:
// CnfmUserDlg.cpp : implementation file
//

#include "stdafx.h"
#include "NetQQ.h"
#include "CnfmUserDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCnfmUserDlg dialog


CCnfmUserDlg::CCnfmUserDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCnfmUserDlg::IDD, pParent)
{
	m_pMainDlg = (CMainDlg*)pParent;
	//{{AFX_DATA_INIT(CCnfmUserDlg)
	m_strConID = _T("");
	m_strConPsw = _T("");
	//}}AFX_DATA_INIT
}


void CCnfmUserDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCnfmUserDlg)
	DDX_Text(pDX, IDC_EDIT_CONFIRMID, m_strConID);
	DDV_MaxChars(pDX, m_strConID, 9);
	DDX_Text(pDX, IDC_EDIT_CONFIRMPSW, m_strConPsw);
	DDV_MaxChars(pDX, m_strConPsw, 9);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCnfmUserDlg, CDialog)
	//{{AFX_MSG_MAP(CCnfmUserDlg)
	ON_BN_CLICKED(IDC_BTN_OK, OnBtnOk)
	ON_BN_CLICKED(IDC_BTN_CANCEL, OnBtnCancel)
	ON_WM_DESTROY()
	ON_WM_CLOSE()
	ON_WM_LBUTTONDOWN()
	ON_WM_PAINT()
	ON_BN_CLICKED(IDC_BUT_CLOSE1, OnCloseWin)
	ON_WM_MOUSEMOVE()
	ON_BN_CLICKED(IDC_BTN_M, OnBtnM)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCnfmUserDlg message handlers

void CCnfmUserDlg::OnBtnOk() 
{
	// TODO: Add your control notification handler code here
	CStatic* pTmp = (CStatic*)GetDlgItem(IDC_STC_MSG);
	UpdateData();
	if(m_strConID.IsEmpty())
	{
		pTmp->SetWindowText("请输入确认帐号!");
		GetDlgItem(IDC_EDIT_CONFIRMID)->SetFocus();
		return;
	}
	if(m_strConPsw.IsEmpty())
	{
		pTmp->SetWindowText("请输入确认密码!");
		GetDlgItem(IDC_EDIT_CONFIRMPSW)->SetFocus();
		return;
	}

	if(m_strConID != m_pMainDlg->m_pLoadDlg->m_strUserId)
	{
		pTmp->SetWindowText("确认帐号有误!");
		GetDlgItem(IDC_EDIT_CONFIRMID)->SetFocus();
		return;	
	}
	if(m_strConPsw != m_pMainDlg->m_pLoadDlg->m_strPassword)
	{
		pTmp->SetWindowText("确认密码有误!");
		GetDlgItem(IDC_EDIT_CONFIRMID)->SetFocus();
		return;	
	}

	m_pMainDlg->PersonalPlace();
	OnCancel();
}

void CCnfmUserDlg::OnCancel()
{
	m_pMainDlg->m_hConfirmWnd = NULL;
	OnDestroy();
}

void CCnfmUserDlg::OnBtnCancel() 
{
	// TODO: Add your control notification handler code here
	OnCancel();
}

void CCnfmUserDlg::OnDestroy() 
{
	CDialog::OnDestroy();
	
	// TODO: Add your message handler code here
	delete this;
}


void CCnfmUserDlg::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	
	OnCancel();
}




void CCnfmUserDlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	CRgn  m_rgn;
	CRect rcWnd;
	GetWindowRect(rcWnd);
	m_rgn.m_hObject = CreateRoundRectRgn(0,0,rcWnd.Width(), rcWnd.Height(),14, 14);
	this->SetWindowRgn(m_rgn,true);	
	
	// Do not call CDialog::OnPaint() for painting messages
}

BOOL CCnfmUserDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_myButtonClose.AutoLoad(IDC_BUT_CLOSE1,this);

	m_myButtonExit.AutoLoad(IDC_BTN_CANCEL,this);

	m_myButtonYes.AutoLoad(IDC_BTN_OK,this);

	m_ttToolTip.CreateToolTip(this);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void CCnfmUserDlg::OnLButtonDown(UINT nFlags, CPoint point) 
{
	PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(point.x,point.y));		
	CDialog::OnLButtonDown(nFlags, point);
}
void CCnfmUserDlg::OnCloseWin() 
{
	// TODO: Add your control notification handler code here
	OnClose();
}
BOOL CCnfmUserDlg::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(m_ttToolTip.GetToolTip().m_hWnd)
		m_ttToolTip.GetToolTip().RelayEvent(pMsg);
	return CDialog::PreTranslateMessage(pMsg);
}

void CCnfmUserDlg::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	m_ttToolTip.AddToolTip("关闭窗口", GetDlgItem(IDC_BUT_CLOSE1));
	CDialog::OnMouseMove(nFlags, point);
}

void CCnfmUserDlg::OnBtnM() 
{
	// TODO: Add your control notification handler code here
	CWnd* pWnd = GetFocus();
	if(pWnd == GetDlgItem(IDC_BTN_CANCEL))
	{
		OnClose();
	}
	else
	{
		OnBtnOk();
	}
}

⌨️ 快捷键说明

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