废话不多说,直接上代码
//获取Debug目录路径


TCHAR _szPath[MAX_PATH + 1] = { 0 };

GetModuleFileName(NULL, _szPath, MAX_PATH);

(_tcsrchr(_szPath, _T('\\')))[1] = 0;//删除文件名,只获得路径 字串

CString strPath;

for (int n = 0; _szPath[n]; n++)

{

if (_szPath[n] != _T('\\'))

{

strPath += _szPath[n];

}

else

{

strPath += _T("\\\\");

}

}

AfxMessageBox(strPath);

// m_print.AddString(strPath);

}