CString strPath,Path="";
//擷取目前工程檔案全路徑
GetModuleFileName(NULL,strPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);
//釋放擷取的空間,此時strPath裡為工程檔案的全路徑
strPath.ReleaseBuffer();
//擷取最後一個“/”的位置
int nPos = strPath.ReverseFind('//');
//擷取全路徑
strPath = strPath.Left(nPos+1);
//擷取字元串的長度
int strLen = strPath.GetLength();
//将路徑的單斜杠改為雙斜杠
for (int i=0;i<=strLen-1;i++)
{
Path += strPath[i];
if(strPath[i] == '//')
Path += '//';
}
//最後加上ini檔案名
Path += "Parameters.ini";
CString cs;
cs.Format("%d",ComThick);
::WritePrivateProfileString("公稱壁厚","Gcbh",cs,Path);