From: sb on
0010c614 7e27e725 ole32!CoUninitialize
0010c61c 7e27eb20 ieframe!SHCoUninitialize+0x10
0010c638 7e27e99e ieframe!SHGetNameAndFlagsW+0x78
0010d6b8 7e27eb4a ieframe!IEGetNameAndFlagsEx+0xf2
0010d6d8 7e2763aa ieframe!IEGetDisplayName+0x1c
0010e744 7e262562 ieframe!GetEventURL+0x3f
0010e7e8 7e22a07b ieframe!FireEvent_BeforeNavigate+0x39
0010e8ec 7e2298fa ieframe!CBaseBrowser2::_FireBeforeNavigateEvent+0x19b
0010f96c 7e25fe44 ieframe!CBaseBrowser2::_NavigateToPidl+0x134
0010fbc0 7e25ff76 ieframe!CBaseBrowser2::_OnGoto+0x31a
0010fbd4 7e21c312 ieframe!CBaseBrowser2::WndProcBS+0x430
0010fbf4 7e21c394 ieframe!CWebBrowserSB::WndProcBS+0x1b
0010fc20 7e286b54 ieframe!CWebBrowserOC::v_WndProc+0x75
0010fc44 77d48734 ieframe!CImpWndProc::s_WndProc+0x65
0010fc70 77d48816 USER32!InternalCallWinProc+0x28
0010fcd8 77d4b89b USER32!UserCallWinProcCheckWow+0x150
0010fd14 77d4b903 USER32!SendMessageWorker+0x4a5
0010fd34 7e260647 USER32!SendMessageW+0x7f
0010fd4c 7e260675 ieframe!CBaseBrowser2::_SendAsyncOperation+0x23
0010fd64 7e25fece ieframe!CBaseBrowser2::_NavigateToPidlAsync+0xa2
0010fd84 7e25ffb3 ieframe!CBaseBrowser2::BrowseObject+0x15c
0010fd98 7e213cc7 ieframe!CIEFrameAuto::_BrowseObject+0x25
00111ed4 7e21591b ieframe!CIEFrameAuto::_NavigateHelper+0x53b
00111f08 7e2155e3 ieframe!CIEFrameAuto::Navigate+0xd4
00111f2c 7829d201 ieframe!CWebBrowserOC::Navigate+0x5e
00111fc8 0042d9c1 MFC80D!CDHtmlDialog::Navigate+0x111

I think this causing me problem because the second time I show a modal
dialog with a CDHtml control I see this and an exception:

CoCreateInstance of OLE control {8856F961-340A-11D0-A96B-00C04FD705A2}
failed.

>>> Result code: 0x800401f0
>>> Is the control is properly registered?

Thanks

From: AliR (VC++ MVP) on
I wasn't able to recreate either of the problems you are having. Can you
create a simple test that recreates a problem, and post the steps here.

AliR.


"sb" <shawnberg(a)gmail.com> wrote in message
news:1165265386.301328.136870(a)80g2000cwy.googlegroups.com...
> 0010c614 7e27e725 ole32!CoUninitialize
> 0010c61c 7e27eb20 ieframe!SHCoUninitialize+0x10
> 0010c638 7e27e99e ieframe!SHGetNameAndFlagsW+0x78
> 0010d6b8 7e27eb4a ieframe!IEGetNameAndFlagsEx+0xf2
> 0010d6d8 7e2763aa ieframe!IEGetDisplayName+0x1c
> 0010e744 7e262562 ieframe!GetEventURL+0x3f
> 0010e7e8 7e22a07b ieframe!FireEvent_BeforeNavigate+0x39
> 0010e8ec 7e2298fa ieframe!CBaseBrowser2::_FireBeforeNavigateEvent+0x19b
> 0010f96c 7e25fe44 ieframe!CBaseBrowser2::_NavigateToPidl+0x134
> 0010fbc0 7e25ff76 ieframe!CBaseBrowser2::_OnGoto+0x31a
> 0010fbd4 7e21c312 ieframe!CBaseBrowser2::WndProcBS+0x430
> 0010fbf4 7e21c394 ieframe!CWebBrowserSB::WndProcBS+0x1b
> 0010fc20 7e286b54 ieframe!CWebBrowserOC::v_WndProc+0x75
> 0010fc44 77d48734 ieframe!CImpWndProc::s_WndProc+0x65
> 0010fc70 77d48816 USER32!InternalCallWinProc+0x28
> 0010fcd8 77d4b89b USER32!UserCallWinProcCheckWow+0x150
> 0010fd14 77d4b903 USER32!SendMessageWorker+0x4a5
> 0010fd34 7e260647 USER32!SendMessageW+0x7f
> 0010fd4c 7e260675 ieframe!CBaseBrowser2::_SendAsyncOperation+0x23
> 0010fd64 7e25fece ieframe!CBaseBrowser2::_NavigateToPidlAsync+0xa2
> 0010fd84 7e25ffb3 ieframe!CBaseBrowser2::BrowseObject+0x15c
> 0010fd98 7e213cc7 ieframe!CIEFrameAuto::_BrowseObject+0x25
> 00111ed4 7e21591b ieframe!CIEFrameAuto::_NavigateHelper+0x53b
> 00111f08 7e2155e3 ieframe!CIEFrameAuto::Navigate+0xd4
> 00111f2c 7829d201 ieframe!CWebBrowserOC::Navigate+0x5e
> 00111fc8 0042d9c1 MFC80D!CDHtmlDialog::Navigate+0x111
>
> I think this causing me problem because the second time I show a modal
> dialog with a CDHtml control I see this and an exception:
>
> CoCreateInstance of OLE control {8856F961-340A-11D0-A96B-00C04FD705A2}
> failed.
>
> >>> Result code: 0x800401f0
> >>> Is the control is properly registered?
>
> Thanks
>


From: sb on
That will be difficult to do, but I will try. First, let me outline
what I'm doing to verify it is correct in principle.

I have an MFC EXE and MFC DLL. The EXE calls a function in the DLL in
response to a user event, which in turn calls a second function to
display the modal dialog that has a CDHtmlDialog object for the HTML
heading.

Both DLL functions start off with a call to
AFX_MANAGE_STATE(AfxGetStaticModuleState()).

In the second DLL function call, I simply instantiate my CDialog object
that has a CDHtmlDialog member variable and then call the DoModal
method for it.

Thanks

From: AliR (VC++ MVP) on
If I understand what you are trying to do correctly, I would tell you to use
the WebBrowser control (IWebBrowser2 Interface) instead of embedding a
CDHtmlDialog in your CDialog.

Here is a good wrapper for the IWebBrowser2
http://www.codeproject.com/miscctrl/simplebrowserformfc.asp

Anyway, I don't think the fact that it's in a DLL should cause any
problems, but I am not a 100%.
Here are some questions: Are you creating the CDHtmlDialog as a child
dialog, using the Create method? Would the same thing happen if you dialogs
were in the exe instead of the DLL?


AliR.


"sb" <shawnberg(a)gmail.com> wrote in message
news:1165270650.839757.269530(a)n67g2000cwd.googlegroups.com...
> That will be difficult to do, but I will try. First, let me outline
> what I'm doing to verify it is correct in principle.
>
> I have an MFC EXE and MFC DLL. The EXE calls a function in the DLL in
> response to a user event, which in turn calls a second function to
> display the modal dialog that has a CDHtmlDialog object for the HTML
> heading.
>
> Both DLL functions start off with a call to
> AFX_MANAGE_STATE(AfxGetStaticModuleState()).
>
> In the second DLL function call, I simply instantiate my CDialog object
> that has a CDHtmlDialog member variable and then call the DoModal
> method for it.
>
> Thanks
>


From: sb on
I'm using the Create method. The core problem is that someone is
calling CoUninitialize on my main thread (the one that called
AfxOleInit) many times usually it is balance with a call to
CoInitialize. If I make sure and call CoIniatialize right before
calling DoModal the problem goes away...but, I don't understand why I'm
seeing in the debugger that ole32!CoUninitialize breakpoints are hit so
many times. Here are some examples:

0012d678 7c9fe24f ole32!CoUninitialize
0012d8a4 7c9f1b7e SHELL32!_CreateFolderIDList+0x155
0012d8cc 7c9ef455 SHELL32!_GetFolderIDListCached+0x84
0012d8f0 7ca26638 SHELL32!SHGetFolderLocation+0x9e
0012d924 7ca2668c SHELL32!_ReparentAliases+0x49
0012d940 7ca266d7 SHELL32!SHILAliasTranslate+0x17
0012d97c 7c9ede50 SHELL32!CDesktopFolder::ParseDisplayName+0xbe
0012d9e4 7c9edd9d SHELL32!CRegFolder::ParseDisplayName+0x93
0012da1c 7ca01aab SHELL32!SHParseDisplayName+0xa3
0012da4c 7ca018ff SHELL32!CShellExecute::_PerfPidl+0x4e
0012da60 7ca01896 SHELL32!CShellExecute::ExecuteNormal+0x46
0012da74 7ca01832 SHELL32!ShellExecuteNormal+0x30
0012da90 7ca40c92 SHELL32!ShellExecuteExW+0x8d
0012eb3c 7ca40f19 SHELL32!ShellExecuteExA+0x203
0012eb8c 025f5ddf SHELL32!ShellExecuteA+0x69


0012b328 7e27e725 ole32!CoUninitialize
0012b330 7e27eb20 ieframe!SHCoUninitialize+0x10
0012b34c 7e27e99e ieframe!SHGetNameAndFlagsW+0x78
0012c3cc 7e27eb4a ieframe!IEGetNameAndFlagsEx+0xf2
0012c3ec 7e277ea7 ieframe!IEGetDisplayName+0x1c
0012c400 7e215aa0 ieframe!CBaseBrowser2::IEGetDisplayName+0x13
0012e544 7e21591b ieframe!CIEFrameAuto::_NavigateHelper+0x30d
0012e578 7e2155e3 ieframe!CIEFrameAuto::Navigate+0xd4
0012e59c 7829d201 ieframe!CWebBrowserOC::Navigate+0x5e


0010b3b8 7e27e725 ole32!CoUninitialize
0010b3c0 7e27eb20 ieframe!SHCoUninitialize+0x10
0010b3dc 7e27e99e ieframe!SHGetNameAndFlagsW+0x78
0010c45c 7e27eb4a ieframe!IEGetNameAndFlagsEx+0xf2
0010c47c 7e264d02 ieframe!IEGetDisplayName+0x1c
0010c498 7e232a47
ieframe!CDocObjectHost::CDOHBindStatusCallback::_GetUrl+0x4d
0010d51c 61423bc5
ieframe!CDocObjectHost::CDOHBindStatusCallback::GetBindInfo+0x177
0010d530 6142413b urlmon!CBSCHolder::GetBindInfo+0x28
0010d548 61423ddd urlmon!CBinding::CallGetBindInfo+0x23
0010d5c0 61423cb7 urlmon!CBinding::StartBinding+0xea
0010d604 61441390 urlmon!CUrlMon::StartBinding+0x169
0010d640 7e23379a urlmon!CUrlMon::BindToObject+0xd5
0010d678 7e22a8c6 ieframe!CDocObjectHost::_StartAsyncBinding+0x19e
0010e720 7e2296c0 ieframe!CDocObjectHost::SetTarget+0x610
0010e758 7e22957d ieframe!CDocObjectView::CreateViewWindow2+0xf4
0010e78c 7e229810 ieframe!CDocObjectView::CreateViewWindow+0x3a
0010e848 7e22972e ieframe!FileCabinet_CreateViewWindow2+0x29d
0010e870 7e229c6c ieframe!CBaseBrowser2::CreateViewWindow+0x4a
0010e8b8 7e229a82 ieframe!CBaseBrowser2::_CreateNewShellView+0x262
0010e8e8 7e2299b3 ieframe!CBaseBrowser2::_CreateNewShellViewPidl+0xe3
0010f96c 7e25fe44 ieframe!CBaseBrowser2::_NavigateToPidl+0x20a
0010fbc0 7e25ff76 ieframe!CBaseBrowser2::_OnGoto+0x31a
0010fbd4 7e21c312 ieframe!CBaseBrowser2::WndProcBS+0x430
0010fbf4 7e21c394 ieframe!CWebBrowserSB::WndProcBS+0x1b
0010fc20 7e286b54 ieframe!CWebBrowserOC::v_WndProc+0x75
0010fc44 77d48734 ieframe!CImpWndProc::s_WndProc+0x65
0010fc70 77d48816 USER32!InternalCallWinProc+0x28
0010fcd8 77d4b89b USER32!UserCallWinProcCheckWow+0x150
0010fd14 77d4b903 USER32!SendMessageWorker+0x4a5
0010fd34 7e260647 USER32!SendMessageW+0x7f
0010fd4c 7e260675 ieframe!CBaseBrowser2::_SendAsyncOperation+0x23
0010fd64 7e25fece ieframe!CBaseBrowser2::_NavigateToPidlAsync+0xa2
0010fd84 7e25ffb3 ieframe!CBaseBrowser2::BrowseObject+0x15c
0010fd98 7e213cc7 ieframe!CIEFrameAuto::_BrowseObject+0x25
00111ed4 7e21591b ieframe!CIEFrameAuto::_NavigateHelper+0x53b
00111f08 7e2155e3 ieframe!CIEFrameAuto::Navigate+0xd4
00111f2c 7829d201 ieframe!CWebBrowserOC::Navigate+0x5e