![]() |
AW: BeginThread - Methoden aufruf
Ich hab emir mal
![]() Als Test, habe ich ein Beispiel von der Homepage genommen
Delphi-Quellcode:
Zwar durch läuft alles korrekt, aber dennoch ist das Formular geblockt, was es ja normaleweise nicht sein sollte.
procedure TForm1.MainProc;
procedure DoSomething; procedure UpdateProgressBar(Percentage: Integer); begin ProgressBar.Position := Percentage; Sleep(20); // This delay does not affect the time for the 0..100 loop // because UpdateProgressBar is non-blocking. end; procedure Finished; begin ShowMessage('Finished'); end; var I: Integer; begin for I := 0 to 100 do begin // Do some time consuming stuff Sleep(30); LocalAsyncVclCall(@UpdateProgressBar, I); // non-blocking end; LocalVclCall(@Finished); // blocking end; var a: IAsyncCall; begin a := LocalAsyncCall(@DoSomething); a.ForceDifferentThread; // Do not execute in the main thread because this will // change LocalAyncVclCall into a blocking LocalVclCall // do something //a.Sync; The Compiler will call this for us in the Interface._Release method end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:12 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz