begin
step2;
closeie;
timer1.tag:=0;
memo2.lines.add(timetostr(now)+' step2');
end
else
begin
step1;
timer1.tag:=1;
memo2.lines.add(timetostr(now)+' step1');
end;
end;
function tform1.isrun:boolean;//判断小人是否在走动
var
bkcolor:tcolor;
r,g,b:byte;
hstr:string;
begin
bkcolor:=getpixel(getdc(0),pmandownx,pmandowny);
r:=getrvalue(bkcolor);
g:=getgvalue(bkcolor);
b:=getbvalue(bkcolor);
hstr:=hexb(r)+hexb(g)+hexb(b);
if hstr=pmandowncolor then
result:=false
else
result:=true;
end;
procedure tform1.button1click(sender: tobject);
begin
timer1.enabled:=not timer1.enabled;
if timer1.enabled then
begin
button1.caption:='click to stop';
label1.font.color:=clgreen;
end
else
begin
button1.caption:='click to start';
label1.font.color:=clred;
isstep2:=false;
end;
end;
end.