⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configother.cpp

📁 用数据库控制树型控件现实内容的例子
💻 CPP
字号:
// ConfigOther.cpp : implementation file
//

#include "stdafx.h"
#include "Kill.h"
#include "ConfigOther.h"

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

/////////////////////////////////////////////////////////////////////////////
// CConfigOther dialog


CConfigOther::CConfigOther(CWnd* pParent /*=NULL*/)
	: CDialog(CConfigOther::IDD, pParent)
{
	//{{AFX_DATA_INIT(CConfigOther)
	m_Password = _T("");
	m_Time = 0;
	//}}AFX_DATA_INIT
}


void CConfigOther::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CConfigOther)
	DDX_Text(pDX, IDC_PASSWORD, m_Password);
	DDX_Text(pDX, IDC_TIME_EDIT, m_Time);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CConfigOther message handlers

BOOL CConfigOther::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	char  appPath[256];
	char inBuf[80];

	GetCurrentDirectory(256,appPath); //取得应用程序当前路径
	CString m_IniFile;
	m_IniFile.Format("%s",appPath);
	m_IniFile+="\\killconfig.ini";

	CString strSection       = "INTERTIME";
	CString strSectionKey    = "TIME";
	GetPrivateProfileString (strSection,strSectionKey, NULL, inBuf, 80, m_IniFile); 
	m_Time=atoi(inBuf);

	strSection       = "PASSWORD";
	strSectionKey    = "PASSWORD";
	GetPrivateProfileString (strSection,strSectionKey, NULL, inBuf, 80, m_IniFile); 
	m_Password=inBuf;
	UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CConfigOther::OnOK() 
{
	// TODO: Add extra validation here
	char  appPath[256];
	char inBuf[80];

	UpdateData(TRUE);
	GetCurrentDirectory(256,appPath); //取得应用程序当前路径
	CString m_IniFile,tempstr;
	m_IniFile.Format("%s",appPath);
	m_IniFile+="\\killconfig.ini";

	CString strSection       = "INTERTIME";
	CString strSectionKey    = "TIME";
	tempstr.Format("%d",m_Time);
	WritePrivateProfileString (strSection,strSectionKey,tempstr, m_IniFile); 

	strSection       = "PASSWORD";
	strSectionKey    = "PASSWORD";
	tempstr=m_Password;
	WritePrivateProfileString (strSection,strSectionKey,tempstr, m_IniFile); 
	
	CDialog::OnOK();
}

⌨️ 快捷键说明

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