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]
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]