OnSettingChange (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example requires a memo and a TApplicationEvent on the form. Change the Windows Locale by using the Regional and Language Options in the Windows Control Panel.

Code

procedure TForm1.ApplicationEvents1SettingChange(Sender: TObject; Flag: Integer; const Section: string; var Result: Integer);
begin
  Memo1.Lines.BeginUpdate;
  try
    Memo1.Lines.Add(Format('Section  = %s', [Section]));
    Memo1.Lines.Add(Format('Flags  = %.8x', [Flag]));
    if AnsiSameStr(Section, 'intl') then
    with SysLocale do
    begin
      Memo1.Lines.Add(Format('DefaultLCID  = %.8x', [DefaultLCID]));
      Memo1.Lines.Add(Format('PriLangID  = %.8x', [PriLangID]));
      Memo1.Lines.Add(Format('SubLangID  = %.8x', [SubLangID]));
      Memo1.Lines.Add(Format('FarEast  = %s', [BoolToStr(FarEast, True)]));
      Memo1.Lines.Add(Format('MiddleEast  = %s', [BoolToStr(MiddleEast, True)]));
    end;
    Memo1.Lines.Add('');
  finally
    Memo1.Lines.EndUpdate;
  end;
//  Result:= 0;
end;

Uses