我有一个MFC对话框,它使用flash player active x control。我在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处理程序不起作用
校准堆栈如下
的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 ::展()
ieframe.dll!CDocObjectHost :: _ ShowMsoView()
ieframe.dll!CDocObjectHost :: ActivateMe()
Mshtml.dll的!CServer :: ActivateView()
Mshtml.dll的!CServer :: DoUIActivate()
Mshtml.dll的!CServer :: DoVerb()
Mshtml.dll的!CMarkup ::导航()
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()