我有一个Delphi控制台应用程序,需要在用户按任意键时终止。问题是我不知道如何实现检测按键的功能,我想做类似以下的操作。
{$APPTYPE CONSOLE}
begin
MyTask:=MyTask.Create;
try
MyTask.RunIt;
while MyTask.Running and not IsKeyPressed do //how i can implement a IsKeyPressed function?
MyTask.SendSignal($56100AA);
finally
MyTask.Stop;
MyTask.Free;
end;
end.