I am looking for a way to find out the path to a users Program Files folder. I know the SHGetSpecialFolderPath API (or SHGetFolderPath for Win 2000 or later) using the CSIDL 'CSIDL_PROGRAM_FILES' will get this but the problem is I can't guarantee users will have shell32.dll version 5.0 or later installed. I know if they have Internet Explorer 5.0 or later running they will have the requisite version of this dll but if they don't....

I am thinking about simply checking a registry key (which is no doubt what the shell programs do anyway). On Win 2000 the key is:

However I don't whether this is consistent across various Windows versions.
Any ideas much appreciated.
Posted on 2004-06-08 17:15:21 by andrew_k
ProgramFilesDir key supported in win9x,nt,2000,xp
Posted on 2004-06-08 22:44:07 by Funbit
Thanks Funbit, this is all I needed to know.
Posted on 2004-06-09 01:30:05 by andrew_k