Arno Garrels wrote:
> Fastream Technologies wrote:
>> I had the same problem. In my case, I had to post a message before
>> ending the thread. There was pending messages that called GetHandle
>> which called AllocateHwnd()!!!
> 
> GetHandle isn't called in my case. There are no connections, I'm just
> pressing btnStart and btnStop.

I played a bit mainly steping thru the code, then reverted changes back 
to the code I posted, and now the error is gone, very strange!


> 
>> 
>> Regards,
>> 
>> SZ
>> 
>> ----- Original Message -----
>> From: "Arno Garrels" <[EMAIL PROTECTED]>
>> To: "ICS support mailing" <twsocket@elists.org>
>> Sent: Thursday, June 22, 2006 4:20 PM
>> Subject: [twsocket] V6 ThreadDetach #2
>> 
>> 
>>> I have the following problem in V6:
>>> 
>>> constructor TListenThread.Create(AServer: TMtWSocketServer);
>>> begin
>>>    inherited Create(True);
>>>    FreeOnTerminate := FALSE;
>>>    FServer         := AServer;
>>>    FServer.ThreadDetach;
>>> end;
>>> 
>>> procedure TListenThread.Execute;
>>> begin
>>>    FServer.ThreadAttach;
>>>    FServer.Listen;
>>>    FServer.MessageLoop;
>>>    FServer.Close;
>>>    FServer.ThreadDetach;
>>> end;
>>> 
>>> procedure TForm1.btnStartClick(Sender: TObject);
>>> begin
>>>    //properties of Server1 are assigned
>>>    FListenThread := TListenThread.Create(Server1);
>>>    FListenThread.Resume;
>>> end;
>>> 
>>> 
>>> procedure TForm1.btnStopClick(Sender: TObject);
>>> begin
>>>    PostMessage(Server1.Handle, WM_QUIT, 0, 0);
>>>    FListenThread.WaitFor;
>>>    FreeAndNil(FListenThread);
>>>   => here the Server1.Handle is not 0!
>>>    Server1.ThreadAttach; // so raises an exception
>>> end;
>>> 
>>> Any idea?
>>> 
>>> ---
>>> Arno Garrels [TeamICS]
>>> http://www.overbyte.be/eng/overbyte/teamics.html
>>> 
>>> --
>>> 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

Reply via email to