CHtmlView中添加NewWindow3
作者:admin 日期:2013-09-07
头文件的中
.h
public:
DECLARE_EVENTSINK_MAP()
void NewWindow3(
IDispatch **ppDisp,
VARIANT_BOOL *Cancel,
DWORD dwFlags,
BSTR bstrUrlContext,
BSTR bstrUrl
) ;
.cpp
#include <exdisp.h>
#include <exdispid.h>
#include <Mshtml.h>
#include <Mshtmdid.h>
#include <shobjidl.h>
BEGIN_EVENTSINK_MAP(CHtmlInExeView, CHtmlView)
ON_EVENT(CHtmlInExeView, AFX_IDW_PANE_FIRST,DISPID_NEWWINDOW3,NewWindow3,VTS_PDISPATCH VTS_PBOOL VTS_I4 VTS_BSTR VTS_BSTR)
//或者
//ON_EVENT(CCometWebBrowser, AFX_IDW_PANE_FIRST,273,NewWindow3,VTS_PDISPATCH VTS_PBOOL VTS_I4 VTS_BSTR VTS_BSTR)
//273 就是DISPID_NEWWINDOW3
END_EVENTSINK_MAP()
void CHtmlInExeView::NewWindow3(IDispatch **ppDisp,
VARIANT_BOOL *Cancel,
DWORD dwFlags,
BSTR bstrUrlContext,
BSTR bstrUrl
)
{
MessageBox(_T("拦截测试"),_T("提示"),MB_OK);
}