RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomApplicationEvents.OnSettingChange Event

Occurs when Windows notifies the application that a system-wide setting has changed.

Pascal
property OnSettingChange: TSettingChangeEvent;
C++
__property TSettingChangeEvent OnSettingChange;

Use OnSettingChange to respond when Windows informs the application that a system-wide setting or policy has changed.  

C++ Examples: 

 

/*
This example requires that a memo and a TApplicationEvent be
added to the form.  Change the Windows Locale by using the
Regional and Language Options in the Windows Control Panel.
*/
void __fastcall TForm1::ApplicationEvents1SettingChange(TObject *Sender, int Flag, const AnsiString Section, int &Result)
{
  Memo1->Lines->BeginUpdate();
  try
  {
//    char buffer[64];
    AnsiString buffer;
    buffer.sprintf("Section = %s", Section.c_str());
    Memo1->Lines->Add(buffer);
    buffer.sprintf("Flag = %8x", Flag);
    Memo1->Lines->Add(buffer);
    if (strcmp(Section.c_str(), "intl") == 0)
    {
      buffer.sprintf("DefaultLCID = %8x", SysLocale.DefaultLCID);
      Memo1->Lines->Add(buffer);
      buffer.sprintf("PriLangID = %8x", SysLocale.PriLangID);
      Memo1->Lines->Add(buffer);
      buffer.sprintf("SubLangID = %8x", SysLocale.SubLangID);
      Memo1->Lines->Add(buffer);
      buffer.sprintf("FarEast = %s", BoolToStr(SysLocale.FarEast, true));
      Memo1->Lines->Add(buffer);
      buffer.sprintf("MiddleEast = %s", BoolToStr(SysLocale.MiddleEast, true));
      Memo1->Lines->Add(buffer);
      Memo1->Lines->Add("");
    }
  }
  __finally
  {
    Memo1->Lines->EndUpdate();
  }
}

 

Delphi Examples: 

{
This example requires that a memo and a TApplicationEvent be
added to the form.  Change the Windows Locale by using the
Regional and Language Options in the Windows Control Panel.
}
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;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!