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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regional settings

Status
Not open for further replies.

Vovin

Programmer
Aug 24, 2003
63
GB
Hi,

I want to change the regional settings for my application. I don't want to permanently change these settings on the host PC (i.e. using SetLocaleInfo). I just want to change regional settings for my application irrespective of the regional settings on the users PC.

This is what I currently have although it doesn't seem to work as it's supposed to:

[tt]Function MakeLCID( lgID: Word; srtid: Word ): DWORD;
Begin
Result := MakeLong( lgid, srtid );
End;

Function MakeLangID( p, s: Word ): Word;
Begin
Result := ( s shl 10 ) or p
End;

procedure InitialiseRegionalSettingsToEnglishUK;
begin
Win32Check( SetThreadLocale(
MakeLCID(
MakeLangID( LANG_ENGLISH, SUBLANG_ENGLISH_UK ), 0)));
GetFormatSettings;
FormatSettings.DecimalSeparator := '.'; // N.B. for some reason SUBLANG_ENGLISH_UK has a ',' decimal separator

Application.UpdateFormatSettings := false; // Prevents format settings being updated automatically when the user alters the system configuration
end;[/tt]
 
Thanks. I managed to work it out. The code in my original post seems to do the job.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top