有用的vc獲取當前目錄的代碼

//獲取當前目錄
CString GetModuleDir()
{
    CString sPath;
    GetModuleFileName(NULL,sPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);
    sPath.ReleaseBuffer();
    int nPos=0;
    nPos=sPath.ReverseFind('\\');
    sPath=sPath.Left (nPos);
    CString file;
    file.Format("當前路徑:%s",sPath);
    AfxMessageBox(file);
    return file;  
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章