Getting the user's 'My Documents' folder
Is there a simple API call to obtain the current user's 'My Documents' folder? I know about SHGetSpecialFolderLocation() but for some strange reason it requires a HWND as the first parameter :confused: (not sure if it can be NULL). I also know there are (mostly convoluted) ways of finding this info from the registry - but I just wondered if there's anything a bit more straightforward?
Re: Getting the user's 'My Documents' folder
SHGetSpecialFolderLocation is obsolete, use SHGetFolderPath with CSIDL_PERSONAL. hwndOwner parameter can be NULL.
Re: Getting the user's 'My Documents' folder
Yes, but that can be NULL. See SHGetFolderPath() also.
Re: Getting the user's 'My Documents' folder
Not sure if this will help as it doesn't give you the "My Documents" folder, however it can point you to the user data area...
Take a look at the environment variables:
APPDATA
HOMEDRIVE and HOMEPATH
USERPROFILE
They will point you to where the user specific items are stored.
Hope it helps.