本文整理自网络,侵删。
//完整代码
library showDLL;
uses
SysUtils,
Windows,
DateUtils,
Graphics;
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;
//写字到屏幕
procedure WriteScreen(Text :string);
var
Cvs :TCanvas;
// I :Integer;
begin
Cvs := TCanvas.Create;
Cvs.Handle := GetDC(0);
Cvs.Brush.Style := bsClear;
Cvs.Font.Color := clRed;
Cvs.Font.Size := 30;
Cvs.Font.Name := '宋体';
Cvs.Font.Style := [fsBold];
Cvs.TextOut(500,400,Text);
ReleaseDC(0, Cvs.Handle);
Cvs.Free;
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.
相关阅读 >>
Delphi webbrowser1 网页提交按钮执行点击事件
Delphi 取得开机时间 开机时间总长度(可精确到秒,分钟等)
Delphi 如何让scrollbox的内容与滚动条一起实时滚动
更多相关阅读请进入《Delphi》频道 >>