Do not use PeekMessage but GetMessage. GetMessage will return fals when WM_QUIT is received, this let you terminate the message loop. Before the message loop, PostMessage a message and from the event handler do anything you need at thread startup, instead of doing it before the message loop.
-- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be ----- Original Message ----- From: "Markus Humm" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Tuesday, February 07, 2006 7:36 PM Subject: [twsocket] Message Loop > Hello, > > my thread's execute method would look like this now: > > var msg:TMsg; > > begin > while not terminated do > begin > case myaction of > acreate: here I'd create a new connection and then status > will be anothing again > aclose: here I'd close a open connection and then status > will be anothing again > anothing: > begin > > if PeekMessage(Msg, 0, 0, 0, pm_noremove) then > begin > TranslateMessage(Msg); > DispatchMessage(Msg); > end; > > end; > end; > end; > end; > > The question now: > > 1. that should work, shouldn't it? > > 2. would pm_noremove be okay, or should I rather pm_remove? > > Greetings > > Markus > > -- > 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 -- 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
