vc 获得当前exe的路径

时间:2014-10-28 19:28:33   收藏:0   阅读:180

TCHAR szStylesPath[_MAX_PATH];

 VERIFY(::GetModuleFileName(
  AfxGetApp()->m_hInstance, szStylesPath, _MAX_PATH));  

 CString csStylesPath(szStylesPath);
 int nIndex  = csStylesPath.ReverseFind(_T(‘\\‘));
 if (nIndex > 0) {
  csStylesPath = csStylesPath.Left(nIndex);
 }
 else {
  csStylesPath.Empty();
 }
 m_csStylesPath += csStylesPath + _T("\\Styles\\");

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!