On 01/12/2011 05:14 PM, Henry Vermaak wrote:

I just tested again here, and using postmessage with gtk2 from an external thread (from a library) works perfectly.
As taken from some example code, I just created a user thread with TMyThread.create(). It does run and does

  while not Terminated do begin
     sleep(2000);
     PostMessage(Handle,  LM_MY_MESSAGE, 2, 0);
  end;

in TFom1 I have:

procedure MyThreadMessage(var MyMessage: TMyMessage); message(LM_MY_MESSAGE);

and

procedure TForm1.MyThreadMessage(var MyMessage: TMyMessage);
begin
  Memo1.Lines.Add('MyMessage' + InttoStr(MyI));
end;

MyThreadMessage is never called, even though the hread is verified to call PostMessage.

What am I doing wrong ?

Have you built your project with -dusecthreads?

Not really. As I did not find where to set this, I deleted the appropriate $ifdef in the project source code. Could this be a problem ? (How to define the -dusecthreads in the Lazarus IDE ?)

Thanks for your answers,
-Michael

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to