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

📄 userinfo.cpp

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

#include "stdafx.h"
#include "NetQQ.h"
#include "UserInfo.h"

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

/////////////////////////////////////////////////////////////////////////////
// CUserInfo dialog


CUserInfo::CUserInfo(CWnd* pParent /*=NULL*/)
	: CDialog(CUserInfo::IDD, pParent)
{
	m_pMainDlg = (CMainDlg*)pParent;
	//{{AFX_DATA_INIT(CUserInfo)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CUserInfo::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CUserInfo)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CUserInfo, CDialog)
	//{{AFX_MSG_MAP(CUserInfo)
	ON_WM_CLOSE()
	ON_WM_DESTROY()
	ON_WM_LBUTTONDOWN()
	ON_WM_PAINT()
	ON_WM_CTLCOLOR()
	ON_BN_CLICKED(IDC_BUT_MIN2, OnButMin2)
	ON_BN_CLICKED(IDC_BUT_CLOSE2, OnButClose2)
	ON_WM_MOUSEMOVE()
	//}}AFX_MSG_MAP
	ON_MESSAGE(WM_SHOW, ShowInfo)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CUserInfo message handlers

void CUserInfo::OnOK() 
{
	// TODO: Add extra validation here
	
	//CDialog::OnOK();
}

void CUserInfo::OnCancel() 
{
	// TODO: Add extra cleanup here
	m_pUserNode->m_hUserInfoWnd = NULL;
	OnDestroy();
}

void CUserInfo::ShowInfo(WPARAM wParam, LPARAM lParam)
{
	CMsgBag mg;
	CString strBuf = (char*)wParam;
	long ret = mg.GetRetStatus(strBuf);

	if(ret == 1)
	{
		CString strRetParam[8];
					
		mg.SplitDate(strBuf,strRetParam);

		SetDlgItemText(IDC_EDIT_UserID,strRetParam[0]);
		SetDlgItemText(IDC_EDIT_USEN,strRetParam[2]);
		SetDlgItemText(IDC_EDIT_SEX,strRetParam[3]);
		SetDlgItemText(IDC_EDIT_DPTM,strRetParam[4]);
		SetDlgItemText(IDC_EDIT_DUTY,strRetParam[5]);
		SetDlgItemText(IDC_EDIT_USERTET,strRetParam[6]);
		SetDlgItemText(IDC_EDIT_USEREMAL,strRetParam[7]);
	}
	else
	{
		AfxMessageBox("数据库正在维护,请稍后再试!");
	}

	delete (char*)wParam;
}

void CUserInfo::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	//m_pMainDlg->m_hUserInfoWnd = NULL;
	OnCancel();
}

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

void CUserInfo::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(point.x,point.y));			
	CDialog::OnLButtonDown(nFlags, point);
}

void CUserInfo::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(),20, 20 );
	this->SetWindowRgn(m_rgn,true);	
	
	// Do not call CDialog::OnPaint() for painting messages
}

HBRUSH CUserInfo::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	pDC->SetBkColor(RGB(254,250,232));
	// TODO: Change any attributes of the DC here
	// TODO: Return a different brush if the default is not desired
	return hbr;
}

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

	m_myButtonMin.AutoLoad(IDC_BUT_MIN2,this);

	m_myButtonYes.AutoLoad(IDC_BUT_CLOSE2,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 CUserInfo::OnButMin2() 
{
	// TODO: Add your control notification handler code here
		PostMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0);
}

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

BOOL CUserInfo::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 CUserInfo::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	m_ttToolTip.AddToolTip("最小化窗口", GetDlgItem(IDC_BUT_MIN2));
	m_ttToolTip.AddToolTip("关闭窗口", GetDlgItem(IDC_BUT_CLOSE2));
	CDialog::OnMouseMove(nFlags, point);
}

⌨️ 快捷键说明

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