获取应用程序的当前目录(VC)

来源:互联网 发布:淘宝收货地址api 编辑:程序博客网 时间:2024/06/05 04:13
//获取当前目录
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;   
}
原创粉丝点击