There is a activex written using MFC and COM . The main class inherits CComObjectRootEx IDispatchImpl CComCoClass IObjectSafetyImpl Now 2threads are created inside this class in the constructor. When IE is refreshed/reloaded, I loss the pointer of the process and threads are not deallocated. So what I did is, made thread ID's as static in the class and deallocate them in the constructor before creating new threads. When I WaitforSingleObject() I always get time out(258). so I call TerminateThread(). I know this is wrong way. Now this method is leaving lot of leaks. Please suggest me a remedy so that I can trap the refresh ask my thread to exit gracefully. Thanks a lot in advance.