Source language: Translate to:

Detecting Users Program Files Directory

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

Detecting Users Program Files Directory

Postby Polaris » Tue Apr 16, 2002 9:08 pm

I need to Detect the Users Program Directory?? It seems like Neobook should have [ProgramsDir] variable but it does not???

So can anyone familiar with the Windows Registry answer a question for me.. I cab use the Windows REgistry Key to get this value.


The thing that i want to know is that this key is the same in Win95,Win98se,Winme,Win2000,WinXP???

I am using XP and that where i found the value... just wondering if it is the same for all systems??? Any help or info would be appreciated


Detecting Users Program Files Directory

Postby Jim Brammer » Wed Apr 17, 2002 12:22 am

...??? Yes. It is as simple as RegistryRead.  Yes, those keys will be the same for each version of Windows.  If the registry were different for every version Windows it would be even more of a nightmare than it is now.

RegistryRead "HKEY_LOCAL_MACHINE" "Software\Microsoft\Windows\CurrentVersion\Version" "[Version]"
... and / or
RegistryRead "HKEY_LOCAL_MACHINE" "Software\Microsoft\Windows\CurrentVersion\ProductName" "[ProductName]"
RegistryRead "HKEY_CURRENT_USER" "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop" "[Desktop]"
RegistryRead "HKEY_CURRENT_USER" "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Cache" "[Temporary_Internet_Files]"
RegistryRead "HKEY_CURRENT_USER" "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Cookies" "[Cookies]"
RegistryRead "HKEY_CURRENT_USER" "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Favorites" "[Favorites]"
RegistryRead "HKEY_CURRENT_USER" "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Fonts" "[Fonts]"
RegistryRead "HKEY_CURRENT_USER" "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\History" "[History]"
RegistryRead "HKEY_CURRENT_USER" "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\My Pictures" "[My_Pictures]"
RegistryRead "HKEY_LOCAL_MACHINE" "Software\Microsoft\Windows\CurrentVersion\MediaPath" "[Media]"
RegistryRead "HKEY_CURRENT_USER" "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\NetHood" "[NetHood]"
RegistryRead "HKEY_CURRENT_USER" "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal" "[My_Documents]"
RegistryRead "HKEY_CURRENT_USER" "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Programs" "[Programs]"
RegistryRead "HKEY_CURRENT_USER" "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Recent" "[Recent]"
RegistryRead "HKEY_CURRENT_USER" "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\SendTo" "[SendTo]"
RegistryRead "HKEY_CURRENT_USER" "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Start Menu" "[Start_Menu]"
RegistryRead "HKEY_CURRENT_USER" "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Startup" "[Startup]"
RegistryRead "HKEY_LOCAL_MACHINE" "Software\Microsoft\Windows\CurrentVersion\ProgramFilesDir" "[ProgramFilesDir]"
... and / or
RegistryRead "HKEY_LOCAL_MACHINE" "Software\Microsoft\Windows\CurrentVersion\ProgramFilesPath" "[ProgramFilesPath]"

Copy & Paste that into a Function file then CALL it and NeoBook magically has a boatload of SystemVariables!  :biggrin:
Jim Brammer

Detecting Users Program Files Directory

Postby Polaris » Wed Apr 17, 2002 11:05 am

Thanks for the input... that will make my job easier...


Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: No registered users and 0 guests