Finding exact path of 'My documents' folder
Hi all,
This is what I do to find the exact path of 'My documents' folder on any XP machine. But it fails on some XP systems.
Code:
CRegKey regKey;
regKey.Open(HKEY_CURRENT_USER,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders")
regKey.QueryValue(NULL,"Personal",&dwValData);
sMyDocumentsPath = (char *)malloc(dwValData);
regKey.QueryValue(sMyDocumentsPath,"Personal",&dwValData)
Can there be any flaws in the above technique?
Re: Finding exact path of 'My documents' folder
SHGetSpecialFolderPath is the function you wanna use:
http://msdn.microsoft.com/library/de...folderpath.asp
The list of CLSIDs:
http://msdn.microsoft.com/library/de...nums/csidl.asp
Edit: for examples of how to use it... use google or the code guru forum. There are quite a few articles (found with both search engines) that will help you use this function. But it's pretty easy to use. Chances are you'll pass NULL for the first param, and the rest are self explanatory (hopefully :))