Wednesday, August 17, 2011

Escape Process

// Press Esc to break out of a process
Application.ProcessMessages;
If GetKeyState(VK_Escape) and 128 = 128 then
begin
if MessageDlg('Stop process?',
  mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
  break;
end;
end;

1 comment:

Pete W said...

Hi Pete, would Application.ProcessMessages work better just preceeding the break command?