Hi,
In a console application I have defined a timed task, which sends an empty string once per minute to keep alive a connection:
FKeepAlive := Parallel.TimedTask.Every(60 * 1000).Execute(
procedure()
begin
FConn.SendStr(''); // will send just ENTER each minute
end
);
When the application is closing - I'm trying to stop the task with following code:
FKeepAlive.Stop;
FKeepAlive.Terminate(5000); // <-- here error is raised
And I'm getting System Error: Invalid window handle
How is the proper way to stop a timed task?