From: swtbase on
Upto WinXP SHGetFolderPath is supported and with Windows Vista it is
to be no longer used says MSDN. I don't want to break compability with
Win XP by using SHGetKnownFolderPath. I need my program to use
SHGetFolderPath if running in XP and older systems and use
SHGetKnownFolderPath if running in Vista or higher. Is there any
provision for this in ShlObj.h? I am running VC++ 2008 Express.
From: maverik on
On Nov 26, 3:03 pm, swtb...(a)gmail.com wrote:
> Upto WinXP SHGetFolderPath is supported and with Windows Vista it is
> to be no longer used says MSDN. I don't want to break compability with
> Win XP by using SHGetKnownFolderPath. I need my program to use
> SHGetFolderPath if running in XP and older systems and use
> SHGetKnownFolderPath if running in Vista or higher. Is there any
> provision for this in ShlObj.h? I am running VC++ 2008 Express.

#if (WINVER > 0x0501)
// Vista or higher
#else
// Upto WinXP
#endif

or if you want

#if (WINVER <= 0x0501)
// Upto WinXP
#else
// Vista, ...
#endif
From: seb on

<swtbase(a)gmail.com> wrote in message
news:6910a6a0-e4cc-4f2f-91a0-099b862fdba4(a)s1g2000prg.googlegroups.com...
> Upto WinXP SHGetFolderPath is supported and with Windows Vista it is
> to be no longer used says MSDN.

It says it's a wrapper for SHGetKnownFolderPath and it's always exported
Then you can use it without problem on Vista


From: swtbase on
On Nov 26, 5:59 pm, Timo Kunze <TKunze71...(a)gmx.de> wrote:
> maverik schrieb:> #if (WINVER > 0x0501)
> > // Vista or higher
> > #else
> > // Upto WinXP
> > #endif
>
> > or if you want
>
> > #if (WINVER <= 0x0501)
> > // Upto WinXP
> > #else
> > // Vista, ...
> > #endif
>
> Don't you need different builds for XP and Vista then?
>
> I'd do it this way:
> - Determine the OS version using GetVersionEx
> - Depending on the determined version:
> a) use SHGetFolderPath
> b) use SHGetKnownFolderPath
> In both cases you shouldn't call SHGet... directly, because then your
> program won't load if one of both functions isn't available on the
> user's system. It's better to use LoadLibrary/GetModuleHandle and
> GetProcAdress to retrieve the address of the function you want to use
> and call the function based on this address.
> So you'll end up with something like this (the code is for
> SHGetKnownFolderIDList):
>
> typedef HRESULT WINAPI SHGetKnownFolderIDListFn(REFKNOWNFOLDERID rfid,
> DWORD dwFlags, HANDLE hToken, __out PIDLIST_ABSOLUTE* ppidl);
> HMODULE hShell32 = GetModuleHandle(TEXT("shell32.dll"));
> if(hShell32) {
>         pfnSHGetKnownFolderIDList =
> reinterpret_cast<SHGetKnownFolderIDListFn*>(GetProcAddress(hShell32,
> "SHGetKnownFolderIDList"));
>         if(pfnSHGetKnownFolderIDList) {
>                 return pfnSHGetKnownFolderIDList(folderID, flags, hToken, ppIDL);
>         }
>
> }
>
> Hope this helps
> Timo
> --www.TimoSoft-Software.de- Unicode controls for VB6
> "Those who sacrifice freedom for safety deserve neither."
> "Demokratie ist per Definition unsicher. Ihr Schutz entsteht aus der
> Überzeugung, dass die demokratischen Kräfte überwiegen und sich – auf
> demokratischem Wege – durchsetzen."

So I will have to implement it myself? Ok then.
By the way, I am using your ExplorerTreeView control. Good work on
that Timo. I wanted to leave a thanks message on ur site but it
required me to register a username (I even tried signning up but never
got an email!). I hope you will make things less complicated for
people wanting to say 'thanks'. Keep contributing...