vc 获得当前exe的路径

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\\");

posted @ 2014-10-28 17:58  runyyf  阅读(208)  评论(0编辑  收藏  举报