Re: [twsocket] Handles in components
Francois, > Paul, you told me in your intial message that having a handle still > allocated prevent desktop switching. As I know you are using threads, I > just > wanted to remind you that to destroy a window handle, you must call Not quite: I wrote "Are there any handles left after freeing the client?" > So both constructor and destructor have to be called > directly or indirectly from TThread.Execute. I know this and everything is created and destroyed in the thread's execute. The thread has a message loop for async communication, and when a desktopchange is detected, then the HttpCli is destroyed, an attempt to switch to the new desktop is made and de HttpCli is recreated within this message loop. So everything happens within the threads execute method. I can see in the tool you pointed me to (Bear) that when I create and destroy the thread, all handles of the thread are destroyed. Unless it's the message loop that's blocking the switch, I can find no reason at all why this thread won't switch and the other threads do. Paul -- 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] Handles in components
>>> Everything is created in the threads execute, so that should be fine. >> >> You have to destroy also at the end of the execute method or from a >> function >> called from there. > > Sure, but that is not the problem. > When a desktop change is detected, these steps are executed: > - destroy HttpCli > - destroy a Timer (uses a handle also) > - switch to inout desktop > - receate HttpCli and timer > > The problem is that it won't change the desktop, other threads I use do. > So there must be something that's blocking it Paul, you told me in your intial message that having a handle still allocated prevent desktop switching. As I know you are using threads, I just wanted to remind you that to destroy a window handle, you must call DestroyWindow from the same thread context as the one which was active at the time of CreateWindow. Translated to components, it mean you must call THttpCli (and others) destructor from the same thread as the one which created the instance. So both constructor and destructor have to be called directly or indirectly from TThread.Execute. Note that speaking ICS, it is enough to call ThreadDetach and ThreadAttach to destroy and recreate the hidden window. No need to fully destroy the component. Also be aware that ICS-V6 share the same window handle for a bunch of components. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] 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] Handles in components
- Original Message - From: "Francois PIETTE" <[EMAIL PROTECTED]> >> Everything is created in the threads execute, so that should be fine. > > You have to destroy also at the end of the execute method or from a > function > called from there. Sure, but that is not the problem. When a desktop change is detected, these steps are executed: - destroy HttpCli - destroy a Timer (uses a handle also) - switch to inout desktop - receate HttpCli and timer The problem is that it won't change the desktop, other threads I use do. So there must be something that's blocking it Paul -- 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] Handles in components
>> Should be no handle left. But pay attention that if you destroy any >> control >> with a window handle from a thread which has not created the control, >> then >> the window handle is /not/destroyed (DestroyWindow fails but usually his >> return value is not checked). >> > > Everything is created in the threads execute, so that should be fine. You have to destroy also at the end of the execute method or from a function called from there. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] 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] Handles in components
- Original Message - From: "Francois PIETTE" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Friday, January 26, 2007 9:04 PM Subject: Re: [twsocket] Handles in components > > Should be no handle left. But pay attention that if you destroy any > control > with a window handle from a thread which has not created the control, then > the window handle is /not/destroyed (DestroyWindow fails but usually his > return value is not checked). > Everything is created in the threads execute, so that should be fine. > Have a look at Bear utility > (http://www.geocities.com/the_real_sz/misc/bear_.htm) it can display the > number of window handles an application use. Very handy to see if they are > freed when you think. I'll test it, but it needs to run as a service because the desktop switching occurs after a user logoff, after which regular applications are destroyed.. Thanks Paul -- 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] Handles in components
> I'm having troubles with switching between desktops using the (Ssl)HttpCli > in a thread with message pump. > You can't switch between desktops when handles are used. > So I'm trying to switch between desktops by freeing the client, switch to > new desktop and recreate the client, but this thread fails to switch to > another desktop. > All other threads used are swithing without problems. > Are there any handles left after freeing the client? Should be no handle left. But pay attention that if you destroy any control with a window handle from a thread which has not created the control, then the window handle is /not/destroyed (DestroyWindow fails but usually his return value is not checked). Have a look at Bear utility (http://www.geocities.com/the_real_sz/misc/bear_.htm) it can display the number of window handles an application use. Very handy to see if they are freed when you think. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] 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