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

📄 mylogin.cpp

📁 聊天室 可以群聊 exe文件图标可以在任务栏的通知区显示,
💻 CPP
字号:
// MyLogin.cpp : implementation file
//

#include "stdafx.h"
#include "猩猩即时通.h"
#include "MyLogin.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyLogin dialog
extern CString szPath;

CMyLogin::CMyLogin(CString *pName, int *pFace, CString *pIp, CWnd* pParent /*=NULL*/)
	: CDialog(CMyLogin::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMyLogin)
	//}}AFX_DATA_INIT
	m_name = pName;;
	m_face = pFace;
	m_ip = pIp;

	posNum = 1;
}


void CMyLogin::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMyLogin)
	DDX_Control(pDX, IDC_STATIC11, m_11);
	DDX_Control(pDX, IDC_EDIT2, m_ipEdit);
	DDX_Control(pDX, IDC_EDIT1, m_nameEdit);
	DDX_Control(pDX, IDC_IMAGE, m_image);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CMyLogin, CDialog)
	//{{AFX_MSG_MAP(CMyLogin)
	ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnDeltaposSpin1)
	ON_WM_ERASEBKGND()
	ON_WM_PAINT()
	ON_WM_CTLCOLOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyLogin message handlers

void CMyLogin::OnDeltaposSpin1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
	// TODO: Add your control notification handler code here

	if (pNMUpDown->iDelta < 0)
	{
		if (posNum != 1)
			posNum = posNum - 1;
	}
	else if (pNMUpDown->iDelta > 0)
	{
		if (posNum != 95)
			posNum = posNum + 1;
	}

	//*m_Head = posNum;

	CString te;
	te.Format("\\face\\%d.bmp", posNum);
	te = szPath + te;
	m_image.SetBitmap((HBITMAP)::LoadImage(NULL,te, IMAGE_BITMAP, 40, 40, LR_LOADFROMFILE));

	*pResult = 0;
}

BOOL CMyLogin::OnInitDialog() 
{
	CDialog::OnInitDialog();
	// TODO: Add extra initialization here
	CString theFirstImage = szPath + "\\face\\1.bmp";
	m_image.SetBitmap((HBITMAP)::LoadImage(NULL,theFirstImage, IMAGE_BITMAP, 40, 40, LR_LOADFROMFILE));
	m_ipEdit.SetWindowText("127.0.0.1");
	//m_nameEdit.SetWindowText("guest");
	
	HICON   m_hIcon;   
    m_hIcon   =   AfxGetApp()->LoadIcon(IDR_MAINFRAME);   
    SetIcon(m_hIcon,   TRUE);       //   Set   big   icon   
    SetIcon(m_hIcon,   FALSE);     //   Set   small   icon

	SetWindowPos(&CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);

	

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CMyLogin::OnCancel() 
{
	// TODO: Add extra cleanup here
	GetParent()->SendMessage(WM_CLOSE, 0, 0);
	CDialog::OnCancel();
}

void CMyLogin::OnOK() 
{
	// TODO: Add extra validation here
	CString isName;
	m_nameEdit.GetWindowText(isName);
	if (isName.IsEmpty())
	{
		MessageBox("用户名不能为空!", "注意", MB_OK|MB_ICONHAND);
		m_nameEdit.SetFocus();
		return;
	}
	m_nameEdit.GetWindowText(*m_name);
	*m_face = posNum;
	m_ipEdit.GetWindowText(*m_ip);
	CDialog::OnOK();
}

BOOL CMyLogin::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	CRect rect;
	GetClientRect(&rect);
	pDC->FillSolidRect(rect, RGB(255, 255, 255));
	return true; //CDialog::OnEraseBkgnd(pDC);
}

void CMyLogin::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	// TODO: Add your message handler code here
	// Do not call CDialog::OnPaint() for painting messages
}

HBRUSH CMyLogin::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	// TODO: Change any attributes of the DC here
	pDC->SetBkMode(TRANSPARENT);
	return (HBRUSH)::GetStockObject(NULL_BRUSH); 
	//return hbr;
}

BOOL CMyLogin::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if (pMsg->message == WM_KEYDOWN)
	{
			Invalidate();
	}

	return CDialog::PreTranslateMessage(pMsg);
}

⌨️ 快捷键说明

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