MFC實現獲取工程的全路徑


        Cstring strPath;

         strPath = _T("");

TCHAR buff[MAX_PATH];
HMODULE hmodle = GetModuleHandle(NULL);
ASSERT(hmodle);
if(GetModuleFileName(hmodle,buff,MAX_PATH) == 0)
return ;
CString str = buff;
int  pos = str.ReverseFind('\\');
if(pos <= 0)
return ;
strPath = str.Left(pos + 1);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章