Re: [twsocket] SetThreadDesktop with ICS

2006-08-14 Thread Arno Garrels
Paul wrote:
> So I have to use ThreadDetach bor both TWSocket and HttpCli ?

No, just call HttpCli.ThreadDetach which also calls ThreadDetach
on the underlying TWSocket instance.

Just to show you the problem (V6):

procedure TCustomWSocket.ThreadDetach;
begin
if (GetCurrentThreadID = DWORD(FThreadID)) and (FHSocket <> INVALID_SOCKET) 
then
WSocket_Synchronized_WSAASyncSelect(FHSocket, Handle, 0, 0);

inherited ThreadDetach;
end;

What is done here is that WSAASyncSelect() is called to stop Winsock
notification messages sent to the hidden window. Then the window
is destroyed (if it's the last TWsocket instance in current thread).

But what would happen if any message is still pending in window's
message queue? 

I'm not 100% sure but I think you you may try to call WSocket_WSAASyncSelect
from your code before calling ThreadDetach and the process possible
pending messages, may be Francois jumps in here. 

> 
> Paul
> 
> 
> - Original Message -
> From: "Arno Garrels" <[EMAIL PROTECTED]>
> To: "ICS support mailing" 
> Sent: Monday, August 14, 2006 5:07 PM
> Subject: Re: [twsocket] SetThreadDesktop with ICS
> 
> 
>> Arno Garrels wrote:
>>> Paul wrote:
>>>> That means I have to free all http clients, switch to a new desktop
>>>> and recreate everything, and continue the existing communications !
>>>> Nearly impossible.
>>>> Is there no other way to do this ?
>>> 
>>> You may try to call ThreadDetach instead which destroys TWSocket's
>>> hidden window in V5. In V6 the window should be destroyed when the
>>> last TWsocket instance of a thread calls ThreadDetach (if memory
>>> serves well).
>> 
>> Well, applies not only to TWSocket's window but also to the component
>> window, if any. HttpClient.ThreadDetach should do it. The problem
>> with ThreadDetach is that the component is windowless unless it is
>> attached again. Francois suggested to do a read on the socket once
>> you are attached again. Maybe processing pending messages before the
>> call to ThreadDetach also avoids losing messages?
>> 
>> 
>> ---
>> 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


Re: [twsocket] SetThreadDesktop with ICS

2006-08-14 Thread Paul
So I have to use ThreadDetach bor both TWSocket and HttpCli ?

Paul


- Original Message - 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Monday, August 14, 2006 5:07 PM
Subject: Re: [twsocket] SetThreadDesktop with ICS


> Arno Garrels wrote:
>> Paul wrote:
>>> That means I have to free all http clients, switch to a new desktop
>>> and recreate everything, and continue the existing communications !
>>> Nearly impossible.
>>> Is there no other way to do this ?
>> 
>> You may try to call ThreadDetach instead which destroys TWSocket's
>> hidden window in V5. In V6 the window should be destroyed when the
>> last TWsocket instance of a thread calls ThreadDetach (if memory
>> serves well).
> 
> Well, applies not only to TWSocket's window but also to the component
> window, if any. HttpClient.ThreadDetach should do it. The problem with
> ThreadDetach is that the component is windowless unless it is attached
> again. Francois suggested to do a read on the socket once you are
> attached again. Maybe processing pending messages before the
> call to ThreadDetach also avoids losing messages?  
> 
> 
> ---
> 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


Re: [twsocket] SetThreadDesktop with ICS

2006-08-14 Thread Arno Garrels
Arno Garrels wrote:
> Paul wrote:
>> That means I have to free all http clients, switch to a new desktop
>> and recreate everything, and continue the existing communications !
>> Nearly impossible.
>> Is there no other way to do this ?
> 
> You may try to call ThreadDetach instead which destroys TWSocket's
> hidden window in V5. In V6 the window should be destroyed when the
> last TWsocket instance of a thread calls ThreadDetach (if memory
> serves well).

Well, applies not only to TWSocket's window but also to the component
window, if any. HttpClient.ThreadDetach should do it. The problem with
ThreadDetach is that the component is windowless unless it is attached
again. Francois suggested to do a read on the socket once you are
attached again. Maybe processing pending messages before the
call to ThreadDetach also avoids losing messages?  


---
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


Re: [twsocket] SetThreadDesktop with ICS

2006-08-14 Thread Arno Garrels
Paul wrote:
> That means I have to free all http clients, switch to a new desktop
> and recreate everything, and continue the existing communications !
> Nearly impossible.
> Is there no other way to do this ?

You may try to call ThreadDetach instead which destroys TWSocket's
hidden window in V5. In V6 the window should be destroyed when the
last TWsocket instance of a thread calls ThreadDetach (if memory
serves well).

---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


> 
> 
> Paul
> 
> - Original Message -
> From: "Arno Garrels" <[EMAIL PROTECTED]>
> To: "ICS support mailing" 
> Sent: Monday, August 14, 2006 4:20 PM
> Subject: Re: [twsocket] SetThreadDesktop with ICS
> 
> 
>> Paul wrote:
>>> Hi,
>>> 
>>> a bit off topic, but I have problems using SetThreadDesktop() api.
>>> It returns error 170 = The requested resource is in use.
>>> Is this because ICS uses hidden windows ?
>> 
>> The online help seems to confirm that.
>> 
>> This function will fail if the calling thread has any windows or
>> hooks on its current desktop (unless hDesktop is a handle to the
>> current desktop).
>> 
>> 
>> ---
>> 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


Re: [twsocket] SetThreadDesktop with ICS

2006-08-14 Thread Paul
That means I have to free all http clients, switch to a new desktop and 
recreate everything, and continue the existing communications !
Nearly impossible.
Is there no other way to do this ?


Paul

- Original Message - 
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" 
Sent: Monday, August 14, 2006 4:20 PM
Subject: Re: [twsocket] SetThreadDesktop with ICS


> Paul wrote:
>> Hi,
>>
>> a bit off topic, but I have problems using SetThreadDesktop() api.
>> It returns error 170 = The requested resource is in use.
>> Is this because ICS uses hidden windows ?
>
> The online help seems to confirm that.
>
> This function will fail if the calling thread has any windows or
> hooks on its current desktop (unless hDesktop is a handle to the
> current desktop).
>
>
> ---
> 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


Re: [twsocket] SetThreadDesktop with ICS

2006-08-14 Thread Arno Garrels
Paul wrote:
> Hi,
> 
> a bit off topic, but I have problems using SetThreadDesktop() api.
> It returns error 170 = The requested resource is in use.
> Is this because ICS uses hidden windows ?

The online help seems to confirm that.

This function will fail if the calling thread has any windows or
hooks on its current desktop (unless hDesktop is a handle to the
current desktop).


---
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