📄 configdlg.cpp
字号:
// ConfigDlg.cpp : implementation file
//
#include "stdafx.h"
#include "mestang.h"
#include "ConfigDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CConfigDlg dialog
CConfigDlg::CConfigDlg(CWnd* pParent /*=NULL*/)
: CDialog(CConfigDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CConfigDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CConfigDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CConfigDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CConfigDlg, CDialog)
//{{AFX_MSG_MAP(CConfigDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CConfigDlg message handlers
BOOL CConfigDlg::OnInitDialog()
{
CDialog::OnInitDialog();
//读取网络地址
CString FilePath;
FilePath+=".\\config.ini";
CString strSection = "Net Configure";
CString strSectionKey = "Net IP";
char inBuf[80];
int num;
GetPrivateProfileString(strSection,strSectionKey, NULL, inBuf, 80, FilePath);
SetDlgItemText(IDC_EDIT_IP,inBuf);
strSectionKey = "Net Port";
GetPrivateProfileString (strSection,strSectionKey, NULL, inBuf, 80, FilePath);
num=atoi(inBuf);
SetDlgItemInt(IDC_EDIT_PORT,num,true);
strSectionKey = "Local IP";
GetPrivateProfileString(strSection,strSectionKey, NULL, inBuf, 80, FilePath);
SetDlgItemText(IDC_EDIT_LOCAL_IP,inBuf);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CConfigDlg::OnOK()
{
CString FilePath;
FilePath+=".\\config.ini";
CString strSection = "Net Configure";
CString strSectionKey = "Net IP";
CString strValue;
GetDlgItemText(IDC_EDIT_IP,strValue);
WritePrivateProfileString (strSection,strSectionKey, strValue, FilePath);
strSectionKey = "Net Port";
GetDlgItemText(IDC_EDIT_PORT,strValue);
WritePrivateProfileString (strSection,strSectionKey,strValue, FilePath);
strSectionKey = "Local IP";
GetDlgItemText(IDC_EDIT_LOCAL_IP,strValue);
WritePrivateProfileString (strSection,strSectionKey,strValue, FilePath);
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -