+1  A: 

Get the home path (%HOMEPATH% environment variable), and then go one folder up (removing the user name).

Patrick
+1  A: 

It's available via the ProfilesDirectory key in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList.

(Note that on Win7 (and Vista?) this will be C:\Users not C:\Documents and Settings.

Alex K.
+1  A: 

Prior to Windows Vista, this can be retrieve via GetProfilesDirectory().

In Windows Vista+, this can be done via the SHGetKnownFolderIDList() and SHGetKnownFolderPath() functions using the FOLDERID_UserProfiles KNOWNFOLDERID constant.

Greg D
+5  A: 

GetProfilesDirectory

Luke
Simple and workMany thanks!
sxingfeng