有两个函数
GetModultName();但是它得到的是完整的文件路径(带文件名称)
_splitpath;它好象必须要五个参数,也不太好!
有没有其它的?

解决方案 »

  1.   

    GetModuleName(),然后去掉文件名。
      

  2.   

    to: ruihuahan
    怎么去掉文件名,
    不要进行字符串操作,好麻烦
      

  3.   

    FilePathName是你从GetModuleName()得到的文件路经
    FilePath就是你要的path
    CString FilePath;
    int i = FilePathName.ReverseFind('\\');
    保留path最后的反斜线则加1,否则不要加1
    FilePath = FilePath.Left(FilePathName.GetLength() - i + 1)
      

  4.   

    int i = FilePathName.ReverseFind('\\');
    FilePathName = FilePath.Left(FilePathName.GetLength() - i + 1)
    这是最简单的了,FilePathName就是你所要的