VC++ GetModuleFileName()获取路径字符串中带波浪线~

  GetModuleFileName()获取的字符串中带波浪线,不是完整的路径显示。

  原因:获取的是短路径,进行了缩写

  解决:还原长路径

   TCHAR strLongPath[MAX_PATH] = { 0 };  
   GetLongPathName( strTempPath, strLongPath, sizeof(strLongPath)/sizeof(TCHAR) );  

  其中,strTempPath是带波浪线的短路径,strLongPath为得到的长路径。

  主要使用了Win32 API函数GetLongPathName,对应地,获取短路径可以使用GetShortPathName

posted on 2016-12-12 18:41  我来乔23  阅读(1123)  评论(0编辑  收藏  举报

导航