> I agree with the first part Francois but I don't see how > SHGetSpecialFolderLocation returns the ProgramFiles Dir. What CSIDL_XXXX > constant is that? CSIDL_PROGRAMS is not it. Maybe there are some new > constants that my help doesn't show.
The doc is at: http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/enums/csidl.asp > VALUE_PATH = 'SOFTWARE\Microsoft\Windows\CurrentVersion'; > VALUE_NAME = 'ProgramFilesDir'; I have no ProgramFilesDir key in my registry (W2K, french). Have you looked at [EMAIL PROTECTED] reply ? -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be ----- Original Message ----- From: "Jim Burns" <[EMAIL PROTECTED]> To: "'Borland's Delphi Discussion List'" <[email protected]> Sent: Monday, April 25, 2005 6:32 PM Subject: RE: Program files dir > > > the path to program files is in the environment variable > > 'ProgramFiles' > > > and you can get the value by using the function > > GetEnvironmentVariable > > > > I don't think it's the right way to get this information. > > Special folders doesn't have the same name in all languages. > > Better to use SHGetSpecialFolderLocation API as I explained > > in my previous message. > > I agree with the first part Francois but I don't see how > SHGetSpecialFolderLocation returns the ProgramFiles Dir. What CSIDL_XXXX > constant is that? CSIDL_PROGRAMS is not it. Maybe there are some new > constants that my help doesn't show. > > You also mention that special folders don't all have the same name, I agree, > but do the Microsoft registry keys still use English when in other > languages? I'm using the following, > > function GetProgramFilesDirectory : string; > const > ROOT_HIVE = HKEY_LOCAL_MACHINE; > VALUE_PATH = 'SOFTWARE\Microsoft\Windows\CurrentVersion'; > VALUE_NAME = 'ProgramFilesDir'; > var > //uR : X_UINT; > hK : HKEY; > vSize : X_UINT; > begin > if (RegOpenKeyEx(ROOT_HIVE, pchar(VALUE_PATH), 0, KEY_READ, hK) = > ERROR_SUCCESS) then begin > if (RegQueryValueEx(hK, pchar(VALUE_NAME), nil, nil, nil, @vSize) = > ERROR_SUCCESS) then begin > SetLength(Result, vSize); > > RegQueryValueEx(hK, pchar(VALUE_NAME), nil, nil, pbyte(Result), > @vSize); > Result[vSize] := '\'; > end; > RegCloseKey(hK); > end; > end; > > > > Would the name of the key "ProgramFilesDir" change with a change in > language? > > > > Regards, > > ------------------------------------------------------------------------ > Jim Burns, <mailto:[EMAIL PROTECTED]> > Technology Dynamics > Pearland, Texas USA > 281 485-0410 / 281 813-6939 > > > _______________________________________________ > Delphi mailing list -> [email protected] > http://www.elists.org/mailman/listinfo/delphi > _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

