📄 dlgallstaset.cpp
字号:
// DlgAllStaSet.cpp : implementation file
//
#include "stdafx.h"
#include "PCM120.h"
#include "DlgAllStaSet.h"
#include "DlgAlDev.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgAllStaSet dialog
CDlgAllStaSet::CDlgAllStaSet(CWnd* pParent /*=NULL*/)
: CDialog(CDlgAllStaSet::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgAllStaSet)
m_iStaCnt = 0;
//}}AFX_DATA_INIT
}
void CDlgAllStaSet::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgAllStaSet)
DDX_Text(pDX, IDC_EDIT_STACNT, m_iStaCnt);
DDV_MinMaxInt(pDX, m_iStaCnt, 1, 255);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgAllStaSet, CDialog)
//{{AFX_MSG_MAP(CDlgAllStaSet)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgAllStaSet message handlers
void CDlgAllStaSet::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
CDlgAlDev dlgaldev;
CString strStdConf;
int iLenConf=0;
CString strPath;
GetModulePath(strPath,NULL);
strPath+="PCM120networksetup.ini";
strStdConf.Format("%d",m_iStaCnt);
WritePrivateProfileString("General","StationCnt",strStdConf,strPath);
for(int i=0;i<m_iStaCnt;i++)
{
int iNumStation;
iNumStation=i+1;
dlgaldev.m_strNameTitle.Format("第%d个站名称",iNumStation);
dlgaldev.strSection.Format("station%d",iNumStation);
CString strx,stry,strp,strq;
strx.Format("%d",100+i%2*200);
WritePrivateProfileString(dlgaldev.strSection,"posionx",strx,strPath);
stry.Format("%d",100+i/2*80+50);
WritePrivateProfileString(dlgaldev.strSection,"posiony",stry,strPath);
strp.Format("%d",100+i%2*200+80);
WritePrivateProfileString(dlgaldev.strSection,"posionp",strp,strPath);
strq.Format("%d",100+i/2*80+130);
WritePrivateProfileString(dlgaldev.strSection,"posionq",strq,strPath);
dlgaldev.DoModal();
}
CDialog::OnOK();
}
void CDlgAllStaSet::GetModulePath(CString &str,LPCTSTR lpszModuleName)
{
TCHAR drive[_MAX_DRIVE];
TCHAR dir[_MAX_DIR];
TCHAR fname[_MAX_FNAME];
TCHAR ext[_MAX_EXT];
TCHAR szPathName[MAX_PATH];
//Modify By Wang 类型由char改为TCHAR
HMODULE hDll = GetModuleHandle(lpszModuleName);
if(GetModuleFileName(hDll, szPathName, MAX_PATH) ==0)
{
TRACE(_T("Get module file name error!"));
}
_tsplitpath(szPathName, drive, dir, fname, ext );
str = drive;
str += dir;
if(str.Right(1) != _T('\\'))
{
str += '\\';
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -