<div class="gmail_quote">On Wed, Jul 25, 2012 at 10:50 PM, Simon <span dir="ltr"><<a href="mailto:s.d.hammett@gmail.com" target="_blank">s.d.hammett@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 25/07/2012 19:34, Gor Gyolchanyan wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi!<br>
<br>
I'm trying to write a WinAPI example to have multi-threaded GUI. I wanna<br>
have a Window class, which creates a window and listens to its messages<br>
in a separate thread when constructed.  This will allow me to write a<br>
main function like this:<br>
<br>
void main()<br>
{<br>
     Window w = new Window;<br>
     w.move(100, 200);<br>
     w.resize(800, 600);<br>
     w.show();<br>
}<br>
<br>
The methods called for the window will send asynchronous messages, which<br>
will cause the window to change its position, size and visibility<br>
on-the-fly. This is convenient, because no message loop needs to be<br>
launched separately and every window will rocess its messages in a<br>
separate thread.<br>
<br>
Can anyone please tell me how to achieve this?<br>
<br>
--<br>
Bye,<br>
Gor Gyolchanyan.<br>
</blockquote>
<br></div></div>
It depends exactly on what you are trying to do, but in general:<br>
<br>
You have to be very, very careful with trying to do multi threading w/ windoze windows. Try doing a google search on it, and the advice is invariably: don't do multi threaded windows. Everybody including people famous for their in-depth window knowledge recommends a single thread UI with non-UI worker threads.<br>

<br>
Having completely separate top level windows each in it's own thread is ok, but if you want to have a parent/child relation between windows in different threads, then you can not use any thread synchronisation primitives all at other than MsgWaitForMultipleObjectsEx, otherwise you will have a guaranteed deadlock. In which case you'd have to do all of the threading your self and not use anything in phobos.<span class="HOEnZb"><font color="#888888"><br>

<br>
-- <br>
My enormous talent is exceeded only by my outrageous laziness.<br>
<a href="http://www.ssTk.co.uk" target="_blank">http://www.ssTk.co.uk</a><br>
<br>
<br>
</font></span></blockquote></div><br>I see. Thanks for the reply. Somehow I suspected this to be the case.<br clear="all"><div><br></div>-- <br>Bye,<br>Gor Gyolchanyan.<br>