我建了一个基于DIALOG的应用程序CDemoApp
BOOL CTitlekeyEntryApp::InitInstance()
{
char iniName[_MAX_PATH];
::_snprintf(iniName, sizeof(iniName), "%s\\Demo.INI", "C:\demo") );free((void*)m_pszProfileName);
m_pszProfileName=_tcsdup(_T(iniName));
CString str = this->GetProfileString("LOGPARAM","FILENAME","aaa.log");
}
Demo.INI 文件内容如下
[LOGPARAM]
DIR =C:\
FILENAME =other.log
MAXSIZE =1024000
HISTORY =2
为什么str=aaa.log,不能从Demo.INI 中读出FILENAME other.log?
BOOL CTitlekeyEntryApp::InitInstance()
{
char iniName[_MAX_PATH];
::_snprintf(iniName, sizeof(iniName), "%s\\Demo.INI", "C:\demo") );free((void*)m_pszProfileName);
m_pszProfileName=_tcsdup(_T(iniName));
CString str = this->GetProfileString("LOGPARAM","FILENAME","aaa.log");
}
Demo.INI 文件内容如下
[LOGPARAM]
DIR =C:\
FILENAME =other.log
MAXSIZE =1024000
HISTORY =2
为什么str=aaa.log,不能从Demo.INI 中读出FILENAME other.log?
还是那句话,用GetPrivateProfileString就可以了。
什么的,m_pszRegistryKey是用来改变什么的?