禁止ie弹出alert窗口

void CXXXDlg::OnNavigateComplete2ExplorerIe(LPDISPATCH pDisp, VARIANT FAR* URL) { CComQIPtr< IHTMLDocument2 > spDocument2; spDocument2 = m_ie.GetDocument(); IHTMLWindow2 *pw; spDocument2->get_parentWindow(&pw); if( pw == NULL ) return; CComBSTR bs1(L"window.alert=myalert; function myalert(u1){}"); CComBSTR bs2(L"JScript"); VARIANT v; VariantInit(&v); pw->execScript(bs1, bs2, &v); VariantClear(&v); ::SysFreeString(bs2); ::SysFreeString(bs1); pw->Release(); }  

 

 

 

 

 

 

 

 

 

 

http://blog.csdn.net/wuhuiran/archive/2008/02/11/2088288.aspx

你可能感兴趣的:(function,IE,null,url)