当前位置:编程学习 > Delphi >>

delphi监控系统时间

当系统时间改变时,如果你要做出反应,你可以处理WM_TimeChange windows 消息


以下是例子代码


原文:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you need to react when system date time has changed you can handle the WM_TimeChange Windows message.
Here's a sample code:

~~~~~~~~~~~~~~~~~~~~~~~~~
type
   TForm1 = class(TForm)
   private
     procedure WMTimeChange(var Msg: TMessage) ; message WM_TIMECHANGE;
   end;

var
   Form1: TForm1;

implementation
{$R *.DFM}

procedure TForm1.WMTimeChange(var Msg: TMessage) ;
begin
   inherited;
   ShowMessage('Date/Time has changed!') ;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~

 


摘自 一刀日记

补充:软件开发 , Delphi ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,