Good evening dear programmers,

As of Windows Vista, SHGetFolderPath is deprecated, and replaced by SHGetKnownFolderPath.

However, my program must be compatible with both OS versions. I used GetVersionEx to determine the version of the OS that the user uses, but the problem comes later on:

main.cpp `SHGetKnownFolderPath' undeclared (first use this function)

I used to get the same problem with SHGetFolderPath which was solved by adding the following to the top of the cpp-file:
#define _WIN32_IE 0x0500

However, SHGetKnownFolderPath is for 502 or higher, and trying a value above it won't solve it, so I'm looking for help here.

If someone has any knowledge about this I'd be really greatful hearing your thoughts.

I think you will need to Vista update to the Windows Platform SDK. I just tried to get it but kept getting link errors, so I don't know what's going on unless the M$ site is just too busy at the moment.

That sounds incredibly bad, I really hope there's another sollution.

According to MSDN the function is supposed to be in shlobj.h, but it isn't there in my version of the WPSDK. Since that is a Vista only function then it has to be in the Vista update to the SDK.

The links are working now and I'm currently installing it.

[edit]Ok, download and install finished. SHGetKnownFolderPath() is in that header file. So if you want to use that function then you need to download and install that sdk too.