📄 dlgserverconfig.cpp
字号:
// DlgServerConfig.cpp : implementation file
//
#include "stdafx.h"
#include "NServer.h"
#include "DlgServerConfig.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgServerConfig dialog
CDlgServerConfig::CDlgServerConfig(CWnd* pParent /*=NULL*/)
: CDialog(CDlgServerConfig::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgServerConfig)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDlgServerConfig::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgServerConfig)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgServerConfig, CDialog)
//{{AFX_MSG_MAP(CDlgServerConfig)
ON_BN_CLICKED(IDC_BTN_YES, OnBtnYes)
ON_BN_CLICKED(IDC_BTN_NO, OnBtnNo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgServerConfig message handlers
void CDlgServerConfig::OnBtnYes()
{
CString serip = "";
CString serport = "";
CString mpath = "";
GetDlgItem(IDC_EDIT_IP)->GetWindowText(serip);
GetDlgItem(IDC_EDIT_PORT)->GetWindowText(serport);
GetDlgItem(IDC_EDIT_MPATH)->GetWindowText(mpath);
if(strlen(serip) <= 0){
MessageBox("服务器IP不能为空!");
return;
}
if(strlen(serport) <= 0){
MessageBox("服务器端口号不能为空!");
return;
}
if(strlen(mpath) <= 0){
MessageBox("文件存放目录不能为空!");
return;
}
((CNServerApp *)AfxGetApp())->m_ServerIP = serip;
((CNServerApp *)AfxGetApp())->m_ServerPort = atoi(serport);
((CNServerApp *)AfxGetApp())->m_strMainPath = mpath;
CDialog::OnOK();
}
void CDlgServerConfig::OnBtnNo()
{
CDialog::OnCancel();
}
BOOL CDlgServerConfig::OnInitDialog()
{
CDialog::OnInitDialog();
GetDlgItem(IDC_EDIT_IP)->SetWindowText(((CNServerApp *)AfxGetApp())->m_ServerIP);
CString str = "";
str.Format("%d",((CNServerApp *)AfxGetApp())->m_ServerPort);
GetDlgItem(IDC_EDIT_PORT)->SetWindowText(str);
GetDlgItem(IDC_EDIT_MPATH)->SetWindowText(((CNServerApp *)AfxGetApp())->m_strMainPath);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -