ITeye博客

有用的vc获取当前目录的代码

feihen · 2011-03-11 16:02 · VC++ · 编程语言 · Markdown

//获取当前目录
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;  
}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。