📄 netmodedlg.cpp
字号:
// NetModeDlg.cpp : implementation file
//
#include "stdafx.h"
#include "DBallGame.h"
#include "NetModeDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CNetModeDlg dialog
CNetModeDlg::CNetModeDlg(CWnd* pParent /*=NULL*/)
: CDialog(CNetModeDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CNetModeDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CNetModeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNetModeDlg)
DDX_Control(pDX, IDC_IPADDRESS, m_ipCtrl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CNetModeDlg, CDialog)
//{{AFX_MSG_MAP(CNetModeDlg)
ON_BN_CLICKED(IDC_SERVERMODE, OnSevermode)
ON_BN_CLICKED(IDC_CLIENTMODE, OnClientmode)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNetModeDlg message handlers
BOOL CNetModeDlg::OnInitDialog()
{
CDialog::OnInitDialog();
btn_server.Attach (GetDlgItem (IDC_SERVERMODE)-> GetSafeHwnd( ));
btn_client.Attach (GetDlgItem (IDC_CLIENTMODE)-> GetSafeHwnd( ));
m_ipCtrl.SetWindowText ("210.30.52.207");
SorC = 2;//2为空
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CNetModeDlg::OnSevermode()
{
SorC = 1;// TODO: Add your control notification handler code here
}
void CNetModeDlg::OnClientmode()
{
SorC = 0;// TODO: Add your control notification handler code here
}
void CNetModeDlg::OnOK()
{
// TODO: Add extra validation here
if(SorC == 2)
{
MessageBox("没有选择");
return ;
}
else if(SorC == 1)
{
}
else
{
BYTE nField[4];
m_ipCtrl.GetAddress(nField[0], nField[1], nField[2], nField[3]);
sprintf(lpszServerAddr,"%d.%d.%d.%d",nField[0],nField[1],nField[2],nField[3]);
}
btn_server.Detach ();
btn_client.Detach ();
CDialog::OnOK();
}
void CNetModeDlg::OnCancel()
{
// TODO: Add extra cleanup here
btn_server.Detach ();
btn_client.Detach ();
CDialog::OnCancel();
}
char * CNetModeDlg::GetIpAddr()
{
return lpszServerAddr;
}
int CNetModeDlg::GetSorC()
{
return SorC;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -