📄 initregdlg.cpp
字号:
// InitRegDlg.cpp : implementation file
//
#include "stdafx.h"
#include "NetQQ.h"
#include "InitRegDlg.h"
#include "RegisterDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInitRegDlg dialog
CInitRegDlg::CInitRegDlg(CWnd* pParent /*=NULL*/)
: CDialog(CInitRegDlg::IDD, pParent)
{
pLoadWnd = (CNetQQDlg*)pParent;
m_RegisterDlg = NULL;
//{{AFX_DATA_INIT(CInitRegDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CInitRegDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CInitRegDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CInitRegDlg, CDialog)
//{{AFX_MSG_MAP(CInitRegDlg)
ON_BN_CLICKED(IDC_BACK, OnBack)
ON_BN_CLICKED(IDC_NEXT, OnNext)
ON_WM_CLOSE()
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
ON_BN_CLICKED(IDC_BTN_CLOSE, OnBtnClose)
ON_BN_CLICKED(IDC_BTN_IR, OnBtnIr)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInitRegDlg message handlers
void CInitRegDlg::OnOK()
{
// TODO: Add extra validation here
//CDialog::OnOK();
}
void CInitRegDlg::OnCancel()
{
// TODO: Add extra cleanup here
}
void CInitRegDlg::OnBack()
{
// TODO: Add your control notification handler code here
OnClose();
}
void CInitRegDlg::OnNext()
{
// TODO: Add your control notification handler code here
((CIPAddressCtrl*)GetDlgItem(IDC_IPADDR_SVR))->GetAddress(m_dwIp);
if(m_dwIp == 0)
{
AfxMessageBox("请输入服务器连接IP!");
((CIPAddressCtrl*)GetDlgItem(IDC_IPADDR_SVR))->SetFieldFocus(0);
return;
}
CString strPort = "";
GetDlgItem(IDC_EDIT_PORT)->GetWindowText(strPort);
if(strPort.IsEmpty())
{
AfxMessageBox("请设置服务器连接端口!");
GetDlgItem(IDC_EDIT_PORT)->SetFocus();
return;
}
m_snPort = atoi(strPort);
ShowWindow(false);
if(!m_RegisterDlg)
{
CRegisterDlg* RegisterDlg = new CRegisterDlg(this);
RegisterDlg->Create(IDD_REGISTER);
m_RegisterDlg = RegisterDlg;
}
((CRegisterDlg*)m_RegisterDlg)->CenterWindow();
(CRegisterDlg*)m_RegisterDlg->ShowWindow(true);
}
CNetQQDlg* CInitRegDlg::GetLoadWnd()
{
return pLoadWnd;
}
BOOL CInitRegDlg::OnInitDialog()
{
CDialog::OnInitDialog();
GetDlgItem(IDC_EDIT_PORT)->SetFocus();
((CIPAddressCtrl*)GetDlgItem(IDC_IPADDR_SVR))->SetAddress(127, 0, 0, 1);
// TODO: Add extra initialization here
//自己定义按纽
m_myButtonBack.AutoLoad(IDC_BACK,this);
m_myButtonNext.AutoLoad(IDC_NEXT,this);
m_myButtonClose.AutoLoad(IDC_BTN_CLOSE,this);
return false; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CInitRegDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
pLoadWnd->ShowWindow(true);
if(m_RegisterDlg)
{
delete m_RegisterDlg;
m_RegisterDlg = NULL;
}
delete this;
}
DWORD CInitRegDlg::GetIpAddr()
{
return m_dwIp;
}
short CInitRegDlg::GetPort()
{
return m_snPort;
}
void CInitRegDlg::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()+1,11, 11 );
this->SetWindowRgn(m_rgn,true);
// Do not call CDialog::OnPaint() for painting messages
}
void CInitRegDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(point.x,point.y));
CDialog::OnLButtonDown(nFlags, point);
}
void CInitRegDlg::OnBtnClose()
{
// TODO: Add your control notification handler code here
OnClose();
}
void CInitRegDlg::OnBtnIr()
{
// TODO: Add your control notification handler code here
CWnd* pWnd = GetFocus();
if(pWnd == GetDlgItem(IDC_BACK))
{
OnBack();
}
else
{
OnNext();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -