var ThreadHandle : THandle;//声明句柄 ThreadID : DWORD;//线程ID
{判断是否为星期六} function RequestDate:Boolean; var s:Integer; begin s := DayOfTheWeek(Now); if s = 1 then begin Result := True; end else Result := False; end;
{判断是否在八点半后} function RequestTime:Boolean; const x = 13; y = 54; var c,q,r,hm:word; //拆分时间 对比 用亲爱的的名字缩写 怀念呀 呵呵 xianzai:tdatetime; //赋值用 现在时间 用于获取 对比 begin xianzai := Now; DecodeTime(xianzai,c,q,r,hm); //拆分时间 if (c >= x) and (q >= y) then begin Result := True; end else Result := False; end;
{整合表演时间} function IsShowTime:Boolean; begin if (RequestDate = True) and (RequestTime = True) then begin Result := True; end else Result := False; end;
function ThreadProc(into:Pointer):Integer;stdcall; begin repeat begin // MessageBox(0,'Yes','警告',MB_ICONEXCLAMATION); Sleep(5000); end; until IsShowTime = True; WriteScreen('我爱你。溶溶'); end;
begin ThreadHandle := CreateThread(nil,0,@ThreadProc,nil,0,ThreadID); end.