C++ MFC 获取程序根目录方法

//获取程序根目录方法

CString GetAppPath()

{

    CString strPath;

    char cCurrentFilePath[255];

    int nTemp;

    GetModuleFileName(NULL, cCurrentFilePath, 255);

    strPath    = cCurrentFilePath;

    nTemp    = strPath.ReverseFind('\\');

    strPath = strPath.Left(nTemp+1);

    return    strPath;

}

posted @ 2011-09-19 11:15  蝌蚪归来  阅读(1169)  评论(0编辑  收藏  举报