#if !defined(AFX_HTMLSCRIPT_H__48E169B0_7344_4131_9060_6B3E951B582A__INCLUDED_)
#define AFX_HTMLSCRIPT_H__48E169B0_7344_4131_9060_6B3E951B582A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif
#include <atlbase.h>
#include <Mshtml.h>
class CHtmlScript
{
public:
CHtmlScript();
~CHtmlScript();
bool SetHtmlScript(IDispatch* pDisp);
const CString GetScriptError() const;
bool CallJScript(const CString strFunc,CString *sResult = NULL);
bool CallJScript(const CString strFunc,const CStringArray& paramArray, CString *sResult = NULL);
bool CallJScript2(const CString strFunc, const CStringArray& paramArray, CString *sResult = NULL);
protected:
void ShowError(LPCSTR lpszText);
bool GetJScript(CComPtr<IDispatch>& spDisp);
protected:
CComPtr<IDispatch> spScript;
CString m_strError;
};
inline
void CHtmlScript::ShowError(LPCSTR lpszText)
{
m_strError = "Applicaion script error:\n" + CString(lpszText);
AfxMessageBox( lpszText, MB_ICONSTOP );
}
inline
const CString CHtmlScript::GetScriptError() const
{
return m_strError;
}
CString GetNextToken(CString& strSrc, const CString strDelim,bool bTrim = false, bool bFindOneOf = true);
#endif