📄 browserutils.h
字号:
/*
This file is part of KCeasy (http://www.kceasy.com)
Copyright (C) 2002-2004 Markus Kern <mkern@kceasy.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
//---------------------------------------------------------------------------
#ifndef BrowserUtilsH
#define BrowserUtilsH
#include <SHDocVw_OCX.h>
#include <mshtml.h>
#include <mshtmhst.h>
#include <string>
//---------------------------------------------------------------------------
using std::string;
/* global helper functions */
// returns true if supplied url is safe for providing our window.external
// interface to it
bool UrlSafeForExternal(const LPCWSTR WUrl);
// load file using res:// protocol from this binary
void BrowserLoadResource(TCppWebBrowser* Browser, const string& Resource);
// load html from string
bool BrowserLoadString(TCppWebBrowser* Browser, const string& Html);
// call JScript function in loaded document
bool BrowserCallScript(TCppWebBrowser* Browser, const string& Func);
// exec JScript in currently loaded document
bool BrowserExecScript(TCppWebBrowser* Browser, const string& Script);
/* interface for access to kceasy stats from the DOM */
class IBrowserExternal
{
public:
IBrowserExternal() {};
~IBrowserExternal() {};
// our stuff
virtual BSTR STDMETHODCALLTYPE getNetworks();
virtual BSTR STDMETHODCALLTYPE getOnlineStatus();
virtual BSTR STDMETHODCALLTYPE getDaemonAddress();
virtual void STDMETHODCALLTYPE UpdateStats();
virtual BSTR STDMETHODCALLTYPE getVersion();
virtual BSTR STDMETHODCALLTYPE getBuildDate();
virtual void STDMETHODCALLTYPE P2PSearch(BSTR BQuery, BSTR BRealm);
};
class TExternalDispatch : public IDispatch
{
public:
TExternalDispatch();
~TExternalDispatch();
// IUnknown
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID classid, void** intf);
virtual ULONG STDMETHODCALLTYPE AddRef();
virtual ULONG STDMETHODCALLTYPE Release();
//IDispatch
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT* pctinfo);
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ ITypeInfo** ppTInfo);
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(
/* [in] */ REFIID riid,
/* [size_is][in] */ LPOLESTR *rgszNames,
/* [in] */ UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ DISPID *rgDispId);
virtual HRESULT STDMETHODCALLTYPE Invoke(
/* [in] */ DISPID dispIdMember,
/* [in] */ REFIID riid,
/* [in] */ LCID lcid,
/* [in] */ WORD wFlags,
/* [out][in] */ DISPPARAMS *pDispParams,
/* [out] */ VARIANT *pVarResult,
/* [out] */ EXCEPINFO *pExcepInfo,
/* [out] */ UINT *puArgErr);
private:
long refcount;
IBrowserExternal* BrowserExternal;
ITypeInfo* TypeInfo;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -