1、选定控件->添加事件处理程序->添加事件NewWindow2和StatusTextChange
2、在这两个事件函数中添加如下代码:
|
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
void CMyPlatformDlg::NewWindow2Explorer1(LPDISPATCH* ppDisp, BOOL* Cancel)
{ // TODO: 在此处添加消息处理程序代码 // *ppDisp = m_webIE.get_Application(); m_webIE.Navigate(m_strUrl, NULL, NULL, NULL, NULL); *Cancel = TRUE; } void CMyPlatformDlg::StatusTextChangeExplorer1(LPCTSTR Text) { // TODO: 在此处添加消息处理程序代码 DWORD dwServiceType= AFX_INET_SERVICE_HTTP; CString strServer; CString strObject; INTERNET_PORT nPort; if (::AfxParseURL(Text,dwServiceType,strServer,strObject,nPort)) { m_strUrl = Text; } } |
如果提示未定义标识符"INTERNET_PORT " "AFX_INET_SERVICE_HTTP"等添加头文件:
#include "Wininet.h"
#include "afxinet.h "

303

被折叠的 条评论
为什么被折叠?



