Arno confirmed your message. I looked at the code. You are probably right. But I think the cure is to fix XSocketDeallocateHWnd (in wsocket.pas) so that all other unit using it is fixed at once:
function XSocketDeallocateHWnd(Wnd: HWND): boolean; begin SetWindowLong(Wnd, 0, 0); // <== ADDED Result := DestroyWindow(Wnd); end; With this fix, the line "SetWindowLong(FWindowHandle, 0, 0);" can be removed from DeallocateSocketHWnd: procedure TCustomWSocket.DeallocateSocketHWnd; begin {$IFDEF DELPHI1} DeallocateHWnd(FWindowHandle); {$ELSE} { Wilfried added check for existing window } if FWindowHandle = 0 then Exit; { Remove the object reference from the window } // SetWindowLong(FWindowHandle, 0, 0); <=== REMOVED { } { if Destructor call's here and it is wrong thread it will not } { so no need to check Thread Id here, it is done in the eadDetach } { method ndowHandle); } if XSocketDeallocateHWnd(FWindowHandle) then FWindowHandle := 0; {$ENDIF} end; Can you verify it works with your test case ? Thanks ! -- [EMAIL PROTECTED] http://www.overbyte.be ----- Original Message ----- From: "Fastream Technologies" <[EMAIL PROTECTED]> To: "ICS support mailing" <twsocket@elists.org> Sent: Saturday, December 24, 2005 8:27 AM Subject: [twsocket] SOLUTION (POSSIBLE NOFORMS BUG) Cannot create a hiddenwindows for TWSocket > Hello FRancois and Arno, > > I found a cure for the problem: > > SetWindowLong(Handle, 0, 0)); // in both THttpConnection and THttpCli > descendents' ddestructor > > SetWindowLong(FCtrlSocket->Handle, 0, 0); // in THttpCli destructor. > > I am using TService, NOFORMS and MT and I am constructing/destructing in > the > same listener thread with correct (no errors) thread(de/at)tach BUT UNLESS > YOU ADD THE ABOVE LINES THAT I BORROWED FROM ICS, APPLICATION CRASHES! > > FYI. > > SubZero > > ----- Original Message ----- > From: "Fastream Technologies" <[EMAIL PROTECTED]> > To: "ICS support mailing" <twsocket@elists.org> > Sent: Friday, December 23, 2005 8:44 PM > Subject: Re: [twsocket] Cannot create a hidden windows for TWSocket > > >> The problem persists!!! :(((( >> >> This load balancer has two sockets per client: one inward and one >> outward. >> The destroyHTTPClient is the THttpCli for the web server connection. >> >> Regards, >> >> SZ >> >> ----- Original Message ----- >> From: "Arno Garrels" <[EMAIL PROTECTED]> >> To: "ICS support mailing" <twsocket@elists.org> >> Sent: Friday, December 23, 2005 7:50 PM >> Subject: Re: [twsocket] Cannot create a hidden windows for TWSocket >> >> >>> Fastream Technologies wrote: >>>> The error occurs when the client is disconnected. The problematic >>>> message >>>> ID is 1025. Here is the non-ICS code: >>>> >>>> void __fastcall httpServerClientClass::TriggerSessionClosed(WORD >>>> ErrCode) >>>> { >>>> if(!FSessionClosedFlag && !serverThread->isTerminated()) >>>> { >>>> FSessionClosedFlag = true; >>>> >>>> if(FServer) >>>> { >>>> if(affinityThread) >>>> { >>>> destroyHTTPClient(); >>>> ThreadDetach(); >>>> >>>> PostThreadMessage(serverThread->ThreadID, >>>> WM_DESTROY_CLIENT, (unsigned int)this, 0); >>>> } >>>> } >>> >>> What is destroyHTTPClient()? >>> >>>> >>>> and the message handler is (in the listener thread): >>>> >>>> case WM_DESTROY_CLIENT: >>>> { >>>> httpServerClientClass *client = >>>> (httpServerClientClass*)(void*)msg.wParam; >>>> client->ThreadAttach(); >>>> client->Release(); >>>> break; >>>> } >>> >>> >>> >>>> >>>> HTH, >>>> >>>> SZ >>>> >>>> ----- Original Message ----- >>>> From: "Francois Piette" <[EMAIL PROTECTED]> >>>> To: <twsocket@elists.org> >>>> Sent: Friday, December 23, 2005 11:35 AM >>>> Subject: [twsocket] Cannot create a hidden windows for TWSocket >>>> >>>> >>>>>> Ok. The problem when I attach the debugger to the service process >>>>>> seems >>>>>> to >>>>>> be "Cannot create a hidden windows for TWSocket.". Any cure for this? >>>>> >>>>> You should try to get windows error number/message to know more. >>>>> Usually you get this when Windows run out of resources. >>>>> The error created in XSocketAllocateHWnd. Grab the error number by >>>>> calling GetLastError. Maybe this >>>>> error number will tell more. >>>>> >>>>> -- >>>>> 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 >>>>> >>>>> >>>>> -- >>>>> 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 >> >> -- >> 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 -- 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