请教一个小问题
用IF.....THEN语句写一条件中文意思是:如果EDIT.TEXT等于系统时间时
执行button.OnClick(sender)
请问这个语句什么样写(主要是EDIT.TEXT=系统时间的那段)

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    if strtodate(edit1.Text)=date then form1.Button2.Click;end;procedure TForm1.Button2Click(Sender: TObject);
    begin
    showmessage('Yes');
      

  2.   

    谢谢!!gxgyj(杰克.逊)、FigoZhu(谢慕安
      

  3.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        Button2: TButton;
        Button3: TButton;
        Edit1: TEdit;
        Timer1: TTimer;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure Button3Click(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure ExitWindowsNT(uFlags : integer);
    var
      hToken : THANDLE;
      tkp, tkDumb : TTokenPrivileges;
      DumbInt : DWORD;
    begin
      FillChar(tkp, sizeof(tkp), 0);
      if not (OpenProcessToken(GetCurrentProcess, TOKEN_ADJUST_PRIVILEGES
    or TOKEN_QUERY, hToken)) then
      raise Exception.create('OpenProcessToken failed with code '+ inttostr(GetLastError));  LookupPrivilegeValue(nil, pchar('SeShutdownPrivilege'),
      tkp.Privileges[0].Luid);  tkp.PrivilegeCount := 1;
      tkp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;  AdjustTokenPrivileges(hToken, false, tkp, sizeof(tkDumb), tkDumb, DumbInt);  if GetLastError <> ERROR_SUCCESS then
      Raise Exception.create('AdjustTokenPrivileges failed with code '+ inttostr(GetLastError));  if not ExitWindowsEx(uFlags, 0) then
      Raise Exception.create('ExitWindowsEx failed with code '+ inttostr(GetLastError));end;procedure TForm1.Button1Click(Sender: TObject);
    begin
         ExitWindowsNT(EWX_SHUTDOWN OR EWX_POWEROFF);
    end;procedure TForm1.Button2Click(Sender: TObject);
    begin
    ExitWindowsNT(EWX_SHUTDOWN OR EWX_REBOOT);
    end;procedure TForm1.Button3Click(Sender: TObject);
    begin
    ExitWindowsEX(EWX_SHUTDOWN OR EWX_LOGOFF,0);
    end;procedure TForm1.Timer1Timer(Sender: TObject);
    begin
         if strtodate(edit1.Text)=date then button1.OnClick(sender)
    end;end.