beforeNavigate2中如何实现?newwindow2中我用:
m_web.SetRegisterAsBrowser(1);
*ppDisp=m_web.GetApplication();
*Cancel=TRUE;
点击连接的时候,却没反映?
m_web.SetRegisterAsBrowser(1);
*ppDisp=m_web.GetApplication();
*Cancel=TRUE;
点击连接的时候,却没反映?
解决方案 »
- 请教一个directshow IMediaDet获取视频帧的问题
- 谁有 数据结构与算法--C++版(第3版) 电子书
- MFC的界面能不能和3维实时(如OPENGL开发的3维程序)显示在同一个框架中
- 能不能禁用鼠标中间滚轮以及方向建对slider控件的控制
- 我有点晕了,dev-c++可以用来开发基于完成端口的网络服务端程序吗?
- masterz,大家都请你留下!!!!!!!!!!!!
- 请问在ASP里有哪种数据类型可对应Com的Variant.VT_ARRAY的
- 我用VC写SDK,怎么老是报错 cannot open Debug/syskeydown.exe for writing
- 对话框加入滚动条后,滚动后对话框上制作的表格乱了
- VC中使用ZIP压缩算法 求保存时使用相对路径
- 如何使多个静态文本框控件都不可见?
- 怎样调用OnCreateClient函数
{
m_web2.SetRegisterAsBrowser(1);
*ppDisp=m_web2.GetApplication();
*Cancel=TRUE;
}
//点击连接的时候为什么没有反映呀?是不是需要在OnBeforeNavigate2中设置什么?
CWinApp* pApp = AfxGetApp(); // Get the correct document template
CDocTemplate* pDocTemplate;
POSITION pos = pApp->GetFirstDocTemplatePosition();
pDocTemplate = pApp->GetNextDocTemplate(pos); ASSERT(pDocTemplate); // Create the new frame
CMainFrame* pNewFrame = (CMainFrame*)pDocTemplate->CreateNewFrame(GetDocument(),(CMainFrame*)AfxGetMainWnd());
ASSERT(pNewFrame); // Activate the frame and set its active view
pDocTemplate->InitialUpdateFrame(pNewFrame, NULL); CMfcieView* pWBVw = (CMfcieView*)pNewFrame->GetActiveView();
ASSERT(pWBVw); pWBVw->SetRegisterAsBrowser(TRUE); *ppDisp = pWBVw->GetApplication();如果还不清楚,请参考微软MSDN PSS ID Number: Q184876
One important way to take control of the WebBrowser Control is to control navigation. You saw earlier how you can intercept DISPID_BEFORENAVIGATE2 in an IDispatch::Invoke implementation to control where your WebBrowser Control will navigate. Another important aspect of navigation is to control how the navigation occurs, especially when opening new windows. Let's say, for instance, that the user clicks the right mouse button over a link and chooses "Open in New Window" or that a page contains a script like this:window.open("www.msn.com");By default, the WebBrowser Control deals with this code by opening a new instance of Internet Explorer to display the page. This may be fine for your application. But then again, it may not. Perhaps you'll want all links to open in your current WebBrowser Control instance. Or perhaps you'll want to open a link in a new WebBrowser Control instance under your control, with your user interface and with your branding.You can intercept an event, DWebBrowserEvents2::NewWindow2, in your IDispatch implementation to control this. Your control needs to connect to the DWebBrowserEvents2 connection point to intercept this event.Once you're connected to DWebBrowserEvents2, implement your IDispatch::Invoke so that it handles DISPID_NEWWINDOW2. During the IDispatch::Invoke function call for DISPID_NEWWINDOW2, the array pDispParams contains two parameters. The first one, at index zero, is a Boolean value that tells the WebBrowser Control whether to cancel the new window or not. By default, it is FALSE and a new window will open. If you want to cancel new window creation completely, set the flag to TRUE.The parameter at index one is a pointer to an IDispatch interface. You can set this parameter to the IDispatch of a WebBrowser Control that you've created. When you pass back an IDispatch like this, MSHTML will use the control you've given it to open the link.