随笔-43  评论-2  文章-6  trackbacks-0
1.截取当前exe全路径的前部分
CString GetModulePath()
{
    CString strPath;
    GetModuleFileName(NULL, strPath.GetBuffer(MAX_PATH), MAX_PATH);
    strPath.ReleaseBuffer();

    
int nPos = strPath.ReverseFind('\\');
    strPath 
= strPath.Left(nPos+1);

    
return strPath;
}
2.截取全路径,得到进程名
CString CutPath(CString szFullPath)
{
    CString szCut;
    szCut.Format(
"%s",szFullPath );
    
int k = szCut.ReverseFind('\\');
    CString szCut2  
= szCut.Mid(k + 1);
    
return szCut2;
}


posted on 2012-12-11 16:33 寻步 阅读(272) 评论(0)  编辑 收藏 引用 所属分类: MFC

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理