Jump to content

communicate between a classic thread and a unigui Form


Recommended Posts

Posted

hi,

i'm trying Synchronize to communicate between my thread and MainForm, 

i've got errors 


var 
iMsBetween : integer;

...

procedure TThreadResults.DoJob ;
var
dTimeDebut : TDateTime;
dTimeFin : TDateTime;
i,j:integer;
begin
  iMsBetween:=0;
  dTimeDebut:=Now;
  for i := 0 to High(integer) do
  begin
     j:=j+1;
  end;
  dTimeFin:=Now;
  iMsBetween := MilliSecondsBetween(dTimeDebut,Now);


  Synchronize(ThreadMess);
end;


procedure TThreadResults.ThreadMess();
begin
   
      MainForm.ShowElapsedTime(iMsBetween);
      
end;

procedure TMainForm.ShowElapsedTime(millisecs:integer);
begin
   MessageDlg( 'elapsed time: ' + inttostr(millisecs), mtWarning, [mbOK], nil);

end;

i didn't found a classic thread example in the unigui samples for doing this , is there a way for doing this ?

 

 

source code project:

http://www.solidfiles.com/d/3e95135c9c/

post-3689-0-24804200-1453713603_thumb.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...