Главная страница | назад





Article #17020: Detecting if the system time has been changed

 Question and Answer Database

FAQ2020D.txt   Detecting if the system time has been changed
Category   :Windows API
Platform    :All
Product    :All 32 bit  

Question:
Is it possible to detect if the system time has been changed by
another application?

Answer:
The following example demonstrates trapping the WM_TIMECHANGE
message. Note: Applications that change the system time should
broadcast a WM_TIMECHANGE message to all top level windows.

type
  TForm1 = class(TForm)
  private
    { Private declarations }
    procedure WMTIMECHANGE(var Message: TWMTIMECHANGE);
       message WM_TIMECHANGE;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.WMTIMECHANGE(var Message: TWMTIMECHANGE);
begin
  Form1.Caption := 'Time Changed';
end;


7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99