mfc >> Crash inside of _AfxMsgFilterHook

by Karim » Tue, 28 Aug 2007 03:33:32 GMT

I have an MFC dll (which links dynamically to MFC) that is used by our
own MFC application. I recently moved some functionality that was
working fine from the application module to the DLL module.
Afterwards, I started seeing crashes inside of _AfxMsgFilterHook while
a message boxes, file dialogs and the ODBC selection dialog was being
displayed. It looks like the module state is invalid and it's
crashing during the AfxGetModuleState()->m_bDLL reference (my
assumption is that AfxGetModuleState is returing NULL).

Upon entry into the DLL, I'm using
AFX_MANAGE_STATE(AfxGetStaticModuleState()) to pop the DLL state onto
the stack. I should also say that other calls into the DLL that
eventually lead to a message box being displayed seem to work fine.

My current workaround is to set the module state ot the applications'
just before the call to the file dialog, odbc dialog and problem
message boxes. Then pop it off immediately afterwards. I don't like
that very much, though, and would like to find out why the state is
being lost.

Any thoughts?



mfc >> Crash inside of _AfxMsgFilterHook

by Ajay Kalra » Tue, 28 Aug 2007 03:39:23 GMT


What sort of MDD is it? Extension of Regular? If its a Regular MFC
DLL, you will need to use AFX_MANAGE_STATE and set the state
correctly. If its an extesion DLL, you should not use
AFX_MANAGE_STATE.

---
Ajay






mfc >> Crash inside of _AfxMsgFilterHook

by Karim » Tue, 28 Aug 2007 04:51:48 GMT

It's a regular DLL that already calls AFX_MANAGE_STATE. That's the
problem. It seems to be losing state after invoking system dialogs
like the Open File dialog, message boxes and ODBC selection dialogs.






Similar Threads

1. Thread deadlock inside CString::AllocBuffer and sudden crashes

2. crash inside CWnd::OnWndMsg

3. Thread deadlock inside CString::AllocBuffer and sudden crashes

4. ATL inside .Net inside HTML inside IE = BAD

5. Accessing and using an ActiveX from inside a HTML page hosted inside a WebBrowser control

Hi.

I have a page that is hosted by a WebBrowser control that is "hosted"
by a WinForms.
The page displays an ActiveX control.

I need, from C# code to access and manipulate the ActiveX control. I
already managed to get a reference to the HTMLObjectElementClass
object, but I need to somehow get the right reference to the ActiveX
object itself so that I will be able to invoke directly it's methods,
like:


myActiveX.Load();

To be more specific. Let's say we have this HTML page:


<html><BODY><table><tr><td>	<object classid=clsid:
464623dc-4d81-11dc-8314-0800200c9a66 id='myControl' width='660',
height='500' >		<PARAM NAME='Host' VALUE='192.168.3.100'/>		<PARAM
NAME='HttpPort' VALUE='80'/>		<PARAM NAME='RTSPPort' VALUE='554'/>
<PARAM NAME='RTSPoverHTTP' VALUE='0'/>		<PARAM NAME='RTSPoverTCP'
VALUE='0'/>		<PARAM NAME='VFormat' VALUE='96'/>		<PARAM
NAME='G72640PT' VALUE='98'/>		<PARAM NAME='G72632PT' VALUE='97'/>
<PARAM NAME='G72624PT' VALUE='99'/>		<PARAM NAME='G72616P' VALUE='100'/
>		<PARAM NAME='AMRPT' VALUE='101'/>		<PARAM NAME='UIMode' VALUE='0'/
>		<PARAM NAME='MediaUsername' VALUE='zozo'/>		<PARAM
NAME='MediaPassword' VALUE='zozo'/>	</object></td></tr></table></
body></html>

I get a reference to the hmtl element like this:

HTMLDocumentClass doc = webBrowser1.Document.DomDocument as
mshtml.HTMLDocumentClass;HTMLObjectElementClass myControl =
doc.all.item("myControl", 0) as HTMLObjectElementClass;

From myControl I need to get a reference to the underlying COM object
with the appropriate type so that I can call methods like this:


myControlCOM.Load();

Thanks.

6. Flash inside of html inside of c++ windows application

7. Repost: Isolation In AppDomain - How to prevent the main AppDomain to crash when another AppDomain Crashes??????

I have a windows service where I create another appdomains.  In the newly
created AppDomain, I make use of a C library. If I issue an Abort(1) within
this library, it simply hard stop my main AppDomain!!!!!!!!!!!!How could I
prevent my main AppDomain to stop when the other stopped?Thanks a lot,Jos


8. How can I get a crash dump when Excel crashes under XP ?