SHGetFolderPath Deprecated: What is alternative to retrieve path for Windows folders?

前端 未结 5 1914
被撕碎了的回忆
被撕碎了的回忆 2020-12-18 01:13

The SHGetFolderPath() function is deprecated beginning with Windows Vista: http://msdn.microsoft.com/en-us/library/bb762181%28v=VS.85%29.aspx

What is th

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-18 01:39

    I faced the same set of errors when I added few new header files to my already working solution.

    I was already calling SHGetFolderPath and had also included #include but it was in a different header file. The solution was compiling without any errors before I added new library header files to it.

    I tried replacing SHGetFolderPath() with SHGetKnownFolderPath() but this just redirected the identifier not found error to SHGetKnownFolderPath.

    On adding #include to the header file of the class calling SHGetFolderPath, the errors ceased and the solution compiled successfully again.

    As mentioned in this page, calling SHGetFolderPath on Windows Vista or a higher OS, will internally call SHGetKnownFolderPath.

提交回复
热议问题