| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #pragma once
- #include <atlbase.h>
- #include <Mshtml.h>
- class CWebPage
- {
- public:
- CWebPage();
- virtual ~CWebPage();
- bool SetDocument(IDispatch* pDisp);
- LPDISPATCH GetHtmlDocument() const;
- const CString GetLastError() const;
- bool GetJScript(CComPtr<IDispatch>& spDisp);
- bool GetJScripts(CComPtr<IHTMLElementCollection>& spColl);
- CString ScanJScript(CString& strAText, CStringArray& args);
- bool CallJScript(const CString strFunc, CComVariant* pVarResult = NULL);
- bool CallJScript(const CString strFunc, const CString strArg1, CComVariant* pVarResult = NULL);
- bool CallJScript(const CString strFunc, const CString strArg1, const CString strArg2, CComVariant* pVarResult = NULL);
- bool CallJScript(const CString strFunc, const CString strArg1, const CString strArg2, const CString strArg3, CComVariant* pVarResult = NULL);
- bool CallJScript(const CString strFunc, const CStringArray& paramArray, CComVariant* pVarResult = NULL);
- protected:
- void ShowError(LPCSTR lpszText);
- protected:
- CComPtr<IHTMLDocument2> m_spDoc;
- CString m_strError;
- };
- inline
- void CWebPage::ShowError(LPCSTR lpszText)
- {
- m_strError = CString(lpszText);
- }
- inline
- const CString CWebPage::GetLastError() const
- {
- return m_strError;
- }
- inline
- LPDISPATCH CWebPage::GetHtmlDocument() const
- {
- return m_spDoc;
- }
- CString GetNextToken(CString& strSrc, const CString strDelim, bool bTrim = false, bool bFindOneOf = true);
|