Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating multilingual Registry entries

Status
Not open for further replies.

adalli

Programmer
Feb 8, 2005
44
MT
Hi,

I am creating a registration file (.reg), where the user will be able to doubleclick on the file and details will be inserted into the registry. The OS is WINXP.

The information I want to insert is a particular path under C:\Program Files.

The problem is that if the WINXP is not English version, I want the path "Program Files" to be written in the language of the OS.

Is there anybody who can tell me how the following path can be changed in order to cater for this.

[HKEY_LOCAL_MACHINE\SOFTWARE\E HACCP\E HACCP\03.00.00]
"myFile"="C:\\Program Files\\Folder1\\"

Many Thanks in advance
 
Look up %ProgramDir% which is the environment variable for the Program fIles folder.

Are you sure you want to do it like this though? Not sure if you can use environment variables in static .reg files?

VBrit
 
One generally compatible way is to read the registry to determine the localized name of program files folder.
[tt]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]
"ProgramFilesDir"="C:\\Program Files"
[/tt]
which will also reflect the localization in action. Mskb article related to this is q178625.

The realization of this approach would be to make this reading programmatically and write the corresponding data to the in the value name you've shown "myFile". This would not be importing a pre-fabricated .reg file as the vehicle to doing it.
 
Hi,

Thanks for your help. There is an Microsoft article regarding this, basically suggesting to create a batch file.


The problem is that the env. variable %ProgramFiles% return "C:\Program Files" - with just one dash.

.. so this leaves me with the option to create it programmatically.

Many thanks
 
Env variables may have problem of backward compatibility. But that may not be a problem.
 
Option Explicit

' vDir can be either one of the ShellSpecialFolder constants (start with ssf), or a normal path string
Public Function GetSpecialPath(vDir As ShellSpecialFolderConstants) As String
' Requires reference to Microsoft Shell Controls and Automation (SHDOC401.dll or Shell32.dll depending on OS version)

With New Shell32.Shell
' The line below should work for almost all versions of SHDOC401.dll/Shell32.dll (versions 4.71 and later on W95, W98)
' GetSpecialPath = .NameSpace(vdir).ParentFolder.ParseName(.NameSpace(vdir).Title).Path
' If you have shell32.dll version 5.0 or later (Windows Me, W2000, XP, W2003) you must use the following instead:
GetSpecialPath = .NameSpace(vDir).Self.Path
End With

End Function

Private Sub Command1_Click()
Debug.Print GetSpecialPath(ssfPROGRAMFILES)
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top