?? setip.cpp
字號(hào):
// SetIP.cpp : implementation file
//
#include "stdafx.h"
#include "VCsample.h"
#include "SetIP.h"
#include "XCRFAPI.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSetIP dialog
CSetIP::CSetIP(CWnd* pParent /*=NULL*/)
: CDialog(CSetIP::IDD, pParent)
{
//{{AFX_DATA_INIT(CSetIP)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CSetIP::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSetIP)
DDX_Control(pDX, IDC_IPADDRESS_GATEWAY, m_GetWayCtl);
DDX_Control(pDX, IDC_IPADDRESS_MASk, m_MaskCtl);
DDX_Control(pDX, IDC_IPADDRESS_IP, m_IpCtl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSetIP, CDialog)
//{{AFX_MSG_MAP(CSetIP)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSetIP message handlers
void CSetIP::OnOK()
{
// TODO: Add extra validation here
if(!UpdateData(TRUE))return;
m_IpCtl.GetWindowText(strIp);
m_MaskCtl.GetWindowText(strMask);
m_GetWayCtl.GetWindowText(strGetWay);
if((m_IpCtl.IsBlank()) ||(m_MaskCtl.IsBlank())||(m_GetWayCtl.IsBlank()))
{
AfxMessageBox("Network parameter error!");
return;
}
CDialog::OnOK();
}
BOOL CSetIP::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CString strTemp;
int i=0;
unsigned char ucRecBuf[256];
memset ( ucRecBuf, 0, 256 );
int Result = XCSysQuery ( m_hCom
, 0x06
, 0x0c
, ucRecBuf);
if( 1 == Result )
{
CString szIp = "";
for ( i = 0; i < 3; i++ )
{
strTemp.Format ( "%01d.", ucRecBuf [ i ] );
szIp += strTemp;
}
strTemp.Format ( "%01d", ucRecBuf [ i ] );
szIp += strTemp;
m_IpCtl.SetWindowText ( szIp );
strIp=szIp;
CString szMask = "";
for ( i = 4 ; i < 7 ; i ++ )
{
strTemp.Format ( "%01d.", ucRecBuf [ i ] );
szMask += strTemp;
}
strTemp.Format ( "%01d", ucRecBuf [ i ] );
szMask += strTemp;
m_MaskCtl.SetWindowText ( szMask );
strMask=szMask;
CString szGate = "";
for ( i = 8; i < 11; i++ )
{
strTemp.Format ( "%01d.", ucRecBuf [ i ] );
szGate += strTemp;
}
strTemp.Format ( "%01d", ucRecBuf [ i ] );
szGate += strTemp;
m_GetWayCtl.SetWindowText ( szGate );
strGetWay=szGate;
}
else
{
m_IpCtl.SetWindowText ( strIp );
m_MaskCtl.SetWindowText ( strMask );
m_GetWayCtl.SetWindowText ( strGetWay );
XCPowerOff ( m_hCom );
}
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -