> For that reason I wrote if it is possible to make it async
> earlier.

Yes, put your code in the event.
 
> I know that I can put something like "Sleep(100)" 

No, that will stop the thread for 100ms so nothing more happens.

If you really can handle events, you can use something like this:

procedure sysDelay (aMs: longword);
var
    Trg: longword;
begin
    Trg := GetTrgMsecs (aMs) ;
    while True do
    begin
        Application.ProcessMessages;
        if Application.Terminated then break ;
        if TestTrgTick (Trg) then break ;
        Sleep(0);   // thread now stops for rest of time slice
    end ;
end;

Something better is used in some ICS high level components
(WaitUntilReady) which exit when the event status changes.  

Angus

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to