if you execute a component in thread context taht need a message pump
(like TWSocket) then you have to pump messages. TWSocket has this on
board, so that's the proposed method.
The message pump (you can write your own of course) I proposed will
break his loop if a WM_QUIT message arrive. So to stop the thread you
have to post a WM_QUIT message to the window.
Depending on the application you wants to do you eventually make your
own message queue or hidden window inside your thread and do what you
note that you dont need thread if intention is only to have a couple of
components. You normally only need thread if you have to execute a
lengthy process yoruself.
Rgds, Wilfried [TeamICS]
Tuesday, October 25, 2005, 20:12, Nick wrote:
> Great :-)
> That all made sense except this line
> HttpCli.CtrlSocket.MessagePump; // will break if WM_QUIT
> What does that mean / do?
> Thanks a lot.
>> Hello Nick,
>>> things at once - do I have to drop 4 HttpCli components on the form or
>>> can I create them at run time?
>> If you drop themon a form then they are created and so will operate in
>> main thread context.
>>> and you can't use 1 HttpCli to download two
>>> things at once
>> No but you can use 4 HttpCli in the same thread doing 4 different
>> downloads. You dont need thread to have multiple components doing the
>> same, all work is done in background while your program can do other
>> things. Note that you can use same event handlers for all the
>>> If I can create them at run time, do you have some same code.
>> procedure SomeThread.Execute;
>> HttpCli: THttpCli;
>> HttpCli := THttpCli.Create(nil);
>> // set properties as wanted
>> // assign event handlers here
>> // connect
>> HttpCli.CtrlSocket.MessagePump; // will break if WM_QUIT
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be