[Win32utils-devel] SHGetFolderPath and stuff

Berger, Daniel Daniel.Berger at qwest.com
Mon Feb 7 11:52:53 EST 2005

Hi Zach
> here's the snippet I use to get the My Documents path on Windows Xp
> proc = GetProcAddress( hDll , "SHGetSpecialFolderPathA" ); 
> //...snip.. (proc)( NULL, cPath, PATH_MYDOCUMENTS, FALSE );

The docs say that SHGetSpecialFolderPath has been superseded by
SHGetFolderPath on Win2k and later, though the docs say that Windows NT
4 SP 4 and later also support it.

Where did you get "PATH_MYDOCUMENTS"?  It's not a CSIDL, but if it's
something we can rely on, I can write the code in such a way as to fall
back on PATH_ macros if the CSIDL_ macro is not supported.
> If you dumpbin shell32 you can grep for all of the SHGet functions... 
> for some odd reason there isa  variation of methods for 
> special folder 
> paths:
> SHGetSpecialFolderPath
> SHGetSpecialFolderPathA
> SHGetSpecialFolderPathU
> Not all exist on every system, is the experience I've had.
> Zach

SHGetSpecialFolderPath is the (older) standard function.
SHGetSpecialFolderPathA is the ANSI version while
SHGetSpecialFolderPathU is the Unicode version.  You usually don't call
the 'A' or 'U' versions directly.  You use SHGetSpecialFolderPath, and
Windows uses either the 'A' or 'U' version behind the scenes, depending
on the value of the UNICODE macro.

At least, that's my understanding.



More information about the win32utils-devel mailing list