Getting Exception when two instance of ActiveX control are opened using Ctrl+N in IE
-
Hi, I have developed a MFC ActiveX control and embeded it in IE. The control is working fine but when another instance of IE is opened using Ctrl+N, I am getting ASSERT exception in debug mode and in Release mode IE crashes. Note that if the second instance is opened without using Ctrl+N (i.e by using explorer icon) no exception arrises. what could be wrong. your support is highly appreciated. Thanks Muhammad Azam
-
Hi, I have developed a MFC ActiveX control and embeded it in IE. The control is working fine but when another instance of IE is opened using Ctrl+N, I am getting ASSERT exception in debug mode and in Release mode IE crashes. Note that if the second instance is opened without using Ctrl+N (i.e by using explorer icon) no exception arrises. what could be wrong. your support is highly appreciated. Thanks Muhammad Azam
You've obviously got a problem with your control when more than one instance of it is created. This is probably a threading issue since IIRC Internet Explorer creates a new thread for each browser window. If your control is marked apartment-threaded (which it is, by default), then the second instance of your control will be running on a different thread from the first. When a second instance is opened by using the icon, a new IEXPLORE.EXE process is created. This gives a whole new address space, so the problem does not occur. It might help diagnose the problem if you post the file and line number on which the ASSERT occurs. Stability. What an interesting concept. -- Chris Maunder
-
You've obviously got a problem with your control when more than one instance of it is created. This is probably a threading issue since IIRC Internet Explorer creates a new thread for each browser window. If your control is marked apartment-threaded (which it is, by default), then the second instance of your control will be running on a different thread from the first. When a second instance is opened by using the icon, a new IEXPLORE.EXE process is created. This gives a whole new address space, so the problem does not occur. It might help diagnose the problem if you post the file and line number on which the ASSERT occurs. Stability. What an interesting concept. -- Chris Maunder
Thanks a Lot Mike, your answer has given me a new dimension to think. first of all i need to know 2 things 1. what is
Mike Dimmick wrote:
IIRC Internet Explorer
and what it does? 2. how co i know whether my control is
Mike Dimmick wrote:
marked apartment-threaded
and is the problem due to the fact that you wrote:
Mike Dimmick wrote:
your control is marked apartment-threaded (which it is, by default), then the second instance of your control will be running on a different thread from the first.
yes the line where i am getting the Assert is, when i try to access Frame window ( that i have created in my control) using
AfxGetApp()->m_pMainFrame
orAfxGetMainWnd()
. thanks once again for your response Muhammad Azam