16,472
社区成员
发帖
与我相关
我的任务
分享
void CMyINI::SetStrSection(LPCTSTR strSection)
{
m_strSection=strSection;
char strBuff[256];
m_FilePath=(char)GetCurrentDirectory(256,strBuff); //获取当前路径
m_FilePath.Format(_T("%s\\uservar.ini"),strBuff);
}
CString CMyINI::m_strSection=_T("");
CString CMyINI::m_FilePath=_T(".\\uservar.ini");
UINT CMyINI::ReadIntINI(LPCTSTR strSectionKey)
{
UINT m_keyInt=1;
m_keyInt=GetPrivateProfileInt(m_strSection,strSectionKey,89,m_FilePath);
if (0==m_keyInt)
{
AfxMessageBox("why is zero??");
AfxMessageBox(m_FilePath);
}
return m_keyInt;
}
void CMyINI::SetStrSection(LPCTSTR strSection)
{
m_strSection=strSection;
char strBuff[256];
::GetModuleFileName(NULL,strBuff,256); //获取当前路径
m_FilePath.Format("%s",strBuff);
int n = m_FilePath.ReverseFind(_T('\\'));
m_FilePath = m_FilePath.Left(n);
m_FilePath=m_FilePath+_T("\\uservar.ini");
}