资源简介
c++开发百度地图api时所需的WebPage.h和WebPage.cpp文件,下载解压导入项目即可。
代码片段和文件信息
/////////////////////////////////////////////////////////////////
// By Eugene Khodakovsky //
// April2002 //
// Eugene@cpplab.com //
// Last Update: April 2002 //
/////////////////////////////////////////////////////////////////
#include “stdafx.h“
//#include “JSCall.h“
#include “WebPage.h“
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
#define CHECK_POINTER(p)\
ATLASSERT(p != NULL);\
if(p == NULL)\
{\
ShowError(“NULL pointer“);\
return false;\
}
const CString GetSystemErrorMessage(DWORD dwError)
{
CString strError;
LPTSTR lpBuffer;
if(!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM
NULL dwError
MAKELANGID(LANG_NEUTRAL SUBLANG_SYS_DEFAULT)
(LPTSTR) &lpBuffer 0 NULL))
{
strError = “FormatMessage Netive Error“ ;
}
else
{
strError = lpBuffer;
LocalFree(lpBuffer);
}
return strError;
}
CString GetNextToken(CString& strSrc const CString strDelimbool bTrim bool bFindOneOf)
{
CString strToken;
int idx = bFindOneOf? strSrc.FindOneOf(strDelim) : strSrc.Find(strDelim);
if(idx != -1)
{
strToken = strSrc.Left(idx);
strSrc = strSrc.Right(strSrc.GetLength() - (idx + 1) );
}
else
{
strToken = strSrc;
strSrc.Empty();
}
if(bTrim)
{
strToken.TrimLeft();
strToken.TrimRight();
}
return strToken;
}
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CWebPage::CWebPage()
{
}
CWebPage::~CWebPage()
{
}
bool CWebPage::SetDocument(IDispatch* pDisp)
{
CHECK_POINTER(pDisp);
m_spDoc = NULL;
CComPtr spDisp = pDisp;
HRESULT hr = spDisp->QueryInterface(IID_IHTMLDocument2(void**)&m_spDoc);
if(FAILED(hr))
{
ShowError(“Failed to get HTML document COM object“);
return false;
}
return true;
}
bool CWebPage::GetJscript(CComPtr& spDisp)
{
CHECK_POINTER(m_spDoc);
HRESULT hr = m_spDoc->get_script(&spDisp);
ATLASSERT(SUCCEEDED(hr));
return SUCCEEDED(hr);
}
bool CWebPage::GetJscripts(CComPtr& spColl)
{
CHECK_POINTER(m_spDoc);
HRESULT hr = m_spDoc->get_scripts(&spColl);
ATLASSERT(SUCCEEDED(hr));
return SUCCEEDED(hr);
}
bool CWebPage::CallJscript(const CString strFuncCComVariant* pVarResult)
{
CStringArray paramArray;
return CallJscript(strFuncparamArraypVarResult);
}
bool CWebPage::CallJscript(const CString strFuncconst CString strArg1CComVariant* pVarResult)
{
CStringArray paramArray;
paramArray.Add(strArg1);
return CallJscript(strFuncparamArraypVarResult);
}
bool CWebPage::CallJscript(const CString strFuncconst CString strArg1const CString strArg
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 47 2018-07-23 19:37 WebPage\readme.txt
文件 5749 2010-03-14 21:32 WebPage\WebPage.cpp
文件 1878 2002-04-30 09:09 WebPage\WebPage.h
目录 0 2018-07-23 19:36 WebPage
----------- --------- ---------- ----- ----
7674 4
评论
共有 条评论