积极答复者
疑难问题

问题
-
在做一个项目,总体要求在对话框中使用html,这里有三个类
class CHtmlBlock : public CBlock //class CBlock是公司做的基类, 没有父类
class CWebView : public CView
class CHtmlDlg : public CDialog
要求是在对话框类中嵌入CWebView类,之后嵌入到CHtmlBlock中
class CHtmlDlg : public CDialog
{
public:
CHtmlDlg(CWnd* pParent = NULL); // standard constructor
CWebView m_webView;
// Dialog Data
//{{AFX_DATA(CHtmlDlg)
enum { IDD = IDD_DLGHTML };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATAprotected:
CRect m_Rect;
HWND hDlg;
//{{AFX_VIRTUAL(CHtmlDlg)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
public:
void NavigateHtml(CString strUrl);
void MoveCtrlWindow(CRect rect);//{{AFX_MSG(CHtmlDlg)
afx_msg void OnSize(UINT nType, int cx, int cy);
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
class CHtmlBlock : public CBlock
{
public:
void AddUrl2Array(CString strUrl);
CHtmlBlock();
virtual ~CHtmlBlock();
void SetUrl(/*CString str*/);
void ShowWebPage();CStringArray m_aUrl;
CString m_strUrl;
CHtmlDlg *m_pHtmlDlg;
protected:
virtual void Size(CRect rect);
virtual void Initial();
virtual void AddData();
virtual void DelData();};
class CWebView : public CView
{
protected:
DECLARE_DYNCREATE(CWebView)
DECLARE_EVENTSINK_MAP()
// Attributes
public:
CWebView();
virtual ~CWebView();CWebBrowser2 m_web;
COleSafeArray vPostData;
IDocHostUIHandler* m_ui;
public:
BOOL CreateFromStatic(UINT nID, CWnd *pParent);
void Navigate2(LPCTSTR lpszURL, DWORD dwFlags = 0,
LPCTSTR lpszTargetFrameName = NULL, LPCTSTR lpszHeaders = NULL,
LPVOID lpvPostData = NULL, DWORD dwPostDataLen = 0);
void ExecWB(OLECMDID cmdID, OLECMDEXECOPT cmdexecopt, VARIANT* pvaIn,
VARIANT* pvaOut);
void Refresh2(int nLevel);
void Stop();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CWebView)
public:
virtual void OnBeforeNavigate2(LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName, CByteArray& baPostedData, LPCTSTR lpszHeaders, BOOL* pbCancel);
virtual void OnNavigateComplete2(LPCTSTR strURL);
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual void DoDataExchange(CDataExchange* pDX);
virtual void OnDownloadBegin();
virtual void OnDownloadComplete();
virtual void Navigate4(LPCTSTR lpszURL, DWORD dwFlags = 0,
LPCTSTR lpszTargetFrameName = NULL,
LPCTSTR lpszHeaders = NULL,
LPVOID lpvPostData = NULL, DWORD dwPostDataLen = 0 );
protected:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
//}}AFX_VIRTUAL// Implementation
protected:
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif// Generated message map functions
protected:
//{{AFX_MSG(CWebView)
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnFocus();
afx_msg void OnTimer(UINT nIDEvent);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};这里有要在CWebView 中响应CHtmlView类中的二个虚函数
OnNavigateComplete2
OnBeforeNavigate2
我想了好多方法也没解决, 求方法
xiao
答案
-
查询创建的浏览器控件的IConnectionPointContainer接口
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- 已标记为答案 wh_xiao 2012年3月29日 13:42
全部回复
-
查询创建的浏览器控件的IConnectionPointContainer接口
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- 已标记为答案 wh_xiao 2012年3月29日 13:42