是否有任何API来获取窗口中的path“C:\ Documents and Settings”?

有没有任何API来获取path:在C + +中的窗口“C:\ Documents and Settings”?

不是:C:\ Documents and Settings \ brianfu \ My Documents。

非常感谢!

感谢卢克的解决scheme:

GetProfilesDirectory 

有用!

GetProfilesDirectory

在Windows Vista之前,可以通过GetProfilesDirectory()来检索。

在Windows Vista +中,可以使用FOLDERID_UserProfiles KNOWNFOLDERID常量通过SHGetKnownFolderIDList()SHGetKnownFolderPath()函数完成此操作 。

获取主路径(%HOMEPATH%环境变量),然后上移一个文件夹(删除用户名)。

它可以通过HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileListProfilesDirectoryHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

(请注意,在Win7(和Vista?)这将是C:\Users不是C:\Documents and Settings