Jump to content

andrey.b

Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. It was just for demo or testing purposes. Now I know that it fails because the Anonymous thread is destroyed sooner than the async procedure ends. The possible workaround is to add some delay, like Sleep(1000), after calling the TThread.CreateAnonymousThread(...).Start method.
  2. Thanks for the reply, Ondrej! I have just added a Button to the form and placed the code in the OnClick handler. Unfortunately, the problem still exists. The new code is: procedure TForm1.Button1Click(Sender: TObject); begin TThread.CreateAnonymousThread( procedure begin Parallel.Async( procedure begin Sleep(100); end); end).Start; end;
  3. Hello everybody, I'm a novice with the OTL. And I've written a simple app to experiment with it. But it causes the EOSError with the "System Error. Code: 1400. Invalid window handle." message in the TOmniContainerWindowsMessageObserverImpl.PostWithRetry method. Could anybody explain what is wrong with my code and (if it is not correct) provide a fix or solution? I use Delphi 10.2.3 (Tokyo) and OTL 3.07.9. Any help is appreciated. This is my code: unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation uses OtlParallel; {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin TThread.CreateAnonymousThread( procedure begin Parallel.Async( procedure begin Sleep(100); end); end).Start; end; end.
×