Unable to call SHGetKnownFolderPath() even with #include <Shlobj.h> and #pragma comment (lib, “Shell32.lib”)

允我心安 提交于 2019-12-01 21:24:50

I had exactly the same problem. Another project with the same code and ancillary files (but different includes) was working.

Putting #include <Shlobj.h> at the top of the file solved the problem.

It might not be replicable though, as it should have worked without doing that. Probably another Visual Studio bug.

Ajay

Try putting following statement before all includes:

#define WINVER 0x0600
#define _WIN32_WINNT 0x0600

Since the documentation says it needs Vista/2008 minimum.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!