#pragma once #include #include class CWebPage { public: CWebPage(); virtual ~CWebPage(); bool SetDocument(IDispatch* pDisp); LPDISPATCH GetHtmlDocument() const; const CString GetLastError() const; bool GetJScript(CComPtr& spDisp); bool GetJScripts(CComPtr& 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 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);