1 //*******************************************************************************
4 // You may use this source code, compile or redistribute it as part of your application
5 // for free. You cannot redistribute it as a part of a software development
6 // library without the agreement of the author. If the sources are
7 // distributed along with the application, you should leave the original
8 // copyright notes in the source code without any changes.
9 // This code can be used WITHOUT ANY WARRANTIES at your own risk.
11 // For the latest updates to this code, check this site:
12 // http://www.masmex.com
15 // Copyright(C) 2000 Philip Oldaker <email: philip@masmex.com>
16 //*******************************************************************************
18 #if !defined(AFX_HTMLMSGVIEW_H__4A8E5045_F2AC_47AE_A24D_584CB7D9D084__INCLUDED_)
19 #define AFX_HTMLMSGVIEW_H__4A8E5045_F2AC_47AE_A24D_584CB7D9D084__INCLUDED_
23 #endif // _MSC_VER > 1000
24 // HtmlMsgView.h : header file
26 /////////////////////////////////////////////////////////////////////////////
27 // CUIHtmlView html view
29 interface IHTMLDocument2;
30 interface IHTMLElement;
31 interface IHTMLImgElement;
32 interface IHTMLObjectElement;
41 class CTRL_EXT_CLASS CUIHtmlView : public CHtmlView
44 CUIHtmlView(); // protected constructor used by dynamic creation
45 DECLARE_DYNAMIC(CUIHtmlView)
49 //{{AFX_DATA(CUIHtmlView)
50 // NOTE: the ClassWizard will add data members here
55 void SetNotifyWnd(HWND hwnd);
56 bool IsWorking() { return m_pHTMLDocument2 == NULL; }
57 IHTMLDocument2 *GetHTMLDocument();
58 void GetElement(LPCTSTR pszID,IHTMLElement **pElement);
59 CString GetBodyText();
62 virtual bool ExecScript(LPCTSTR pszScript,LPCTSTR pszLang=NULL,_variant_t *pvt=NULL);
63 virtual bool SetElementText(LPCTSTR pszElemID,LPCTSTR pszText);
64 virtual bool SetElementHTML(LPCTSTR pszElemID,LPCTSTR pszText);
65 virtual bool SetElementValue(LPCTSTR pszElemID,LPCTSTR pszText);
66 virtual bool SetImageSource(LPCTSTR pszElemID,LPCTSTR pszText);
67 virtual bool AddOptionString(LPCTSTR pszElemID,LPCTSTR pszText,LPCTSTR pszValue,bool bSelect=false);
68 virtual bool SetOptionString(LPCTSTR pszElemID,LPCTSTR pszText);
69 virtual bool GetOptionString(LPCTSTR pszElemID,CString &sText,CString &sValue);
70 virtual CString GetElementText(LPCTSTR pszElemID);
71 virtual CString GetElementHTML(LPCTSTR pszElemID);
72 virtual CString GetElementValue(LPCTSTR pszElemID);
73 virtual void ParseDocument();
76 virtual void DocumentReady();
77 virtual void ActiveXControl(IHTMLObjectElement *pObj);
78 virtual void ImageElement(IHTMLImgElement *pImg);
79 virtual void Element(IHTMLElement *pElement);
81 // ClassWizard generated virtual function overrides
82 //{{AFX_VIRTUAL(CUIHtmlView)
84 virtual void OnBeforeNavigate2(LPCTSTR lpszURL, DWORD nFlags, LPCTSTR lpszTargetFrameName, CByteArray& baPostedData, LPCTSTR lpszHeaders, BOOL* pbCancel);
85 virtual void OnCommandStateChange(long nCommand, BOOL bEnable);
87 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
88 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
89 virtual void DocumentComplete(LPDISPATCH pDisp, VARIANT* URL);
90 virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
91 virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView);
92 virtual void OnTitleChange(LPCTSTR lpszText);
93 virtual void OnDocumentComplete(LPCTSTR lpszUrl);
98 void ReleaseDocument();
99 virtual ~CUIHtmlView();
101 virtual void AssertValid() const;
102 virtual void Dump(CDumpContext& dc) const;
105 // Generated message map functions
106 //{{AFX_MSG(CUIHtmlView)
107 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
108 afx_msg void OnBrowserGoBack();
109 afx_msg void OnBrowserGoForward();
110 afx_msg void OnBrowserGoHome();
111 afx_msg void OnBrowserRefresh();
112 afx_msg void OnBrowserStop();
113 afx_msg void OnUpdateBrowserGoBack(CCmdUI *pUI);
114 afx_msg void OnUpdateBrowserGoForward(CCmdUI *pUI);
116 DECLARE_MESSAGE_MAP()
118 IHTMLDocument2 *m_pHTMLDocument2;
119 BOOL m_bDocumentComplete;
126 inline void CUIHtmlView::SetNotifyWnd(HWND hwnd)
131 inline IHTMLDocument2 *CUIHtmlView::GetHTMLDocument()
133 ASSERT(m_pHTMLDocument2);
134 return m_pHTMLDocument2;
136 /////////////////////////////////////////////////////////////////////////////
138 //{{AFX_INSERT_LOCATION}}
139 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
141 #endif // !defined(AFX_HTMLMSGVIEW_H__4A8E5045_F2AC_47AE_A24D_584CB7D9D084__INCLUDED_)