setparamdlg.cpp

来自「visual c++ 实例编程」· C++ 代码 · 共 68 行

CPP
68
字号
// SetParamDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ProcessKiller.h"
#include "SetParamDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSetParamDlg dialog


CSetParamDlg::CSetParamDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSetParamDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSetParamDlg)
	m_szProcessName = _T("");
	m_nInterval = 0;
	//}}AFX_DATA_INIT
}


void CSetParamDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSetParamDlg)
	DDX_Text(pDX, IDC_PROCESSNAME, m_szProcessName);
	DDV_MaxChars(pDX, m_szProcessName, 255);
	DDX_Text(pDX, IDC_INTERVAL, m_nInterval);
	DDV_MinMaxUInt(pDX, m_nInterval, 0, 3600);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSetParamDlg, CDialog)
	//{{AFX_MSG_MAP(CSetParamDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSetParamDlg message handlers

BOOL CSetParamDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_szProcessName = AfxGetApp()->GetProfileString("INI","ProcessName",NULL);
	m_nInterval = AfxGetApp()->GetProfileInt("INI","Interval",0);
	UpdateData(FALSE);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSetParamDlg::OnOK() 
{
	UpdateData(TRUE);
	AfxGetApp()->WriteProfileString("INI","ProcessName",m_szProcessName);
	AfxGetApp()->WriteProfileInt("INI","Interval",m_nInterval);
	MessageBox("You need stop and then restart to use your new parameter.","Info",MB_ICONINFORMATION);
	CDialog::OnOK();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?