在Delphi里,警告并不会导致编译失败,只是提示你这样代码存在
。只要自己能掌握不安全因素,用try来处理不安全因素引发的问题,这样程序就不会完全崩溃了。
unit Unit1interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrlstype
TForm1 = class(TForm)
Timer1: TTimer
Label1: TLabel
Label2: TLabel
procedure Timer1Timer(Sender: TObject)
private
{ Private declarations }
public
{ Public declarations }
endvar
Form1: TForm1implementation{$R *.dfm}procedure TForm1.Timer1Timer(Sender: TObject)
var s :string
begin
Label1.Caption := FormatDateTime('yyyy/mm/dd AM/PM hh:mm ', Now + 0.125)
Label2.Caption := FormatDateTime('hhmmss',now())
if(FormatDateTime('hhmmss',now())='000000') then
showmessage(FormatDateTime('yyyy/mm/dd AM/PM hh:mm ', Now + 0.125))
endend.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)