#include <io.h>
#include <window.h>
TCHAR tmpPath[260] = {0};
GetModuleFileName( NULL, tmpPath, 260 ); //获取当前进程已加载模块的文件的完整路径,该模块必须由当前进程加载。
(_tcsrchr(tmpPath,_T('\\')))[1] = 0;
strcat(tmpPath, "\\test.ini");
if((_access(tmpPath, 0)) == -1)
{
//AfxMessageBox("创建工程文件成功");
WritePrivateProfileString("PFAC", "visable", "true", tmpPath);
WritePrivateProfileString("PFAC", "mode", "6", tmpPath);
}
else
{
if(::DeleteFile(tmpPath))
{
//AfxMessageBox("删除工程文件成功");
}
else
{
AfxMessageBox("删除工程文件失败");
}
}
解惑:
1. (_tcsrchr(szFilePath, _T('\