0

我有一个使用 Flash 播放器主动 x 控件的 MFC 对话。我在 x86 程序中没有问题,但是当为 x64 构建时,我开始在对话的消息循环中抛出浮点异常。我可以处理其中的第一个,但不是全部。

控件的创建在 OnInitDialog() 中完成

typedef HRESULT (WINAPI *LPAtlAxWinInit)();
typedef HRESULT (WINAPI *LPAtlAxGetControl)(HWND hwnd, IUnknown** unk);
#define MsgLoopWhile(a) while(a) { GetMessage(&msg,0,0,0); DispatchMessage(&msg); }


LPAtlAxWinInit AtlAxWinInit = (LPAtlAxWinInit)GetProcAddress(
         LoadLibrary(_T("atl")),"AtlAxWinInit");
LPAtlAxGetControl AtlAxGetControl = (LPAtlAxGetControl)GetProcAddress(
         LoadLibrary(_T("atl")),"AtlAxGetControl"); 
HRESULT hr = AtlAxWinInit();
if (FAILED(hr))
    return FALSE;
m_hFlashWnd = CreateWindow(_T("AtlAxWin"), m_strFileName, WS_CHILD|WS_VISIBLE, 0, 0, 0, 0, this->GetSafeHwnd(), 0, 0, 0);

if(!m_hFlashWnd)
{
    ::AfxMessageBox(LoadStr(IDS_FLASH_NOT_INSTALLED));
    ::PostMessage(WM_CLOSE);
    return FALSE;
}

CComQIPtr<IUnknown, &IID_IUnknown> pComI = NULL;
hr = AtlAxGetControl(m_hFlashWnd, &pComI);
if (FAILED(hr))
    return FALSE;

MSG msg;
CComQIPtr<IWebBrowser2> pComBrow = pComI;
CComPtr<IDispatch> pDisp;
if(pComBrow) 
    MsgLoopWhile( !pComBrow->get_Document(&pDisp) && !pDisp );         // Document loading loop
CComQIPtr<IHTMLDocument2> pComHtml = pDisp;
CComPtr<IHTMLElementCollection> pElems;
hr = pComHtml ? pComHtml->get_embeds(&pElems) : -1;
if(SUCCEEDED(hr))
{
    CComVariant id;
    pDisp = NULL;
    MsgLoopWhile( pElems && !pElems->item(id,id,&pDisp) && !pDisp );
}   

异常在最后一个循环中抛出。

重置异常标志或使用 SEH 处理程序不起作用

cal栈如下

mshtml.dll!CLayout::GetElementLayoutTransform()
mshtml.dll!CLayout::CalcSize()
mshtml.dll!CLayout::CalcTopLayoutSize()
mshtml.dll!CView::EnsureSize()
mshtml.dll!CView::EnsureView()
mshtml.dll!CDoc::RunningToInPlace()
mshtml.dll!CServer::Show()
ieframe.dll!CDocObjectHost::_ShowMsoView()
ieframe.dll!CDocObjectHost::ActivateMe()
mshtml.dll!CServer::ActivateView()
mshtml.dll!CServer::DoUIActivate()
mshtml.dll!CServer::DoVerb()
mshtml.dll!CMarkup::Navigate()
ieframe.dll!CDocObjectHost::_ActivateMsoView()
ieframe.dll!CDocObjectHost::UIActivate()
ieframe.dll!CDocObjectView::UIActivate()
ieframe.dll!CBaseBrowser2::_UIActivateView()
ieframe.dll!CBaseBrowser2::v_ActivatePendingView()
ieframe.dll!CWebBrowserSB::v_ActivatePendingView()
ieframe.dll!CBaseBrowser2::_ExecShellDocView()
ieframe.dll!CBaseBrowser2::Exec()
ieframe.dll!CWebBrowserSB::Exec()
ieframe.dll!CDocObjectHost::_OnReadyState()
ieframe.dll!CDocObjectHost::_OnChangedReadyState()
ieframe.dll!CDocObjectHost::OnChanged()
mshtml.dll!CBase::FirePropertyNotify()
mshtml.dll!CMarkup::SetReadyState()
mshtml.dll!CMarkup::SetInteractiveInternal()
mshtml.dll!CMarkup::RequestReadystateInteractive()
mshtml.dll!CMarkup::BlockScriptExecutionHelper()
mshtml.dll!CHtmPost::Exec()
user32.dll!DefWindowProcWorker()

4

0 回答 0