首页新闻找找看学习计划

请问,这个文件中的代码是做什么的,它的作用是什么

0
悬赏园豆:10 [已解决问题] 解决于 2012-07-25 15:50

// SimpleHost.h : CSimpleHost 的声明

#pragma once

#include <MsHtml.h>
#include <Mshtmdid.h>
#include <comutil.h>
#include <comdef.h>
#include <comdefsp.h>
#include <DocObj.h>


class ie_browser_dlg;

class ATL_NO_VTABLE CSimpleHost :
 public CComObjectRootEx<CComSingleThreadModel>,
 public CComCoClass<CSimpleHost, &CLSID_NULL>,
 IDispatchImpl<IDocHostUIHandlerDispatch, &IID_IDocHostUIHandlerDispatch, &CAtlModule::m_libid, /*wMajor =*/ 0xFFFF, /*wMinor =*/ 0xFFFF>,
    IInternetSecurityManager,
 IOleContainer,
 IOleCommandTarget,
    IServiceProvider
{
public:
 CSimpleHost(void);
 ~CSimpleHost(void);

 BEGIN_COM_MAP(CSimpleHost)
  COM_INTERFACE_ENTRY(IDocHostUIHandlerDispatch)
        COM_INTERFACE_ENTRY(IInternetSecurityManager)
  COM_INTERFACE_ENTRY(IOleCommandTarget)
  COM_INTERFACE_ENTRY2(IDispatch, IDocHostUIHandlerDispatch)
  COM_INTERFACE_ENTRY(IOleContainer)
        COM_INTERFACE_ENTRY(IServiceProvider)
 END_COM_MAP()
       
    BEGIN_SERVICE_MAP(CSimpleHost)
        SERVICE_ENTRY(__uuidof(IInternetSecurityManager))
    END_SERVICE_MAP()

 DECLARE_PROTECT_FINAL_CONSTRUCT()

 HRESULT FinalConstruct()
 {
  return S_OK;
 }

 void FinalRelease()
 {
 }

 // IDocHostUIHandlerDispatch Methods
public:

 //Called from MSHTML to display a context menu.
 virtual HRESULT STDMETHODCALLTYPE ShowContextMenu(
  /* [in] */ DWORD dwID,
  /* [in] */ DWORD x,
  /* [in] */ DWORD y,
  /* [in] */ IUnknown *pcmdtReserved,
  /* [in] */ IDispatch *pdispReserved,
  /* [retval][out] */ HRESULT *dwRetVal);

 //Retrieves the UI capabilities of MSHTML host.
 virtual HRESULT STDMETHODCALLTYPE GetHostInfo(
  /* [out][in] */ DWORD *pdwFlags,
  /* [out][in] */ DWORD *pdwDoubleClick);

 //Allows the host to replace MSHTML menus and toolbars.
 virtual HRESULT STDMETHODCALLTYPE ShowUI(
  /* [in] */ DWORD dwID,
  /* [in] */ IUnknown *pActiveObject,
  /* [in] */ IUnknown *pCommandTarget,
  /* [in] */ IUnknown *pFrame,
  /* [in] */ IUnknown *pDoc,
  /* [retval][out] */ HRESULT *dwRetVal);

 //Called when MSHTML removes its menus and toolbars.
 virtual HRESULT STDMETHODCALLTYPE HideUI( void);

 //Notifies the host that the command state has changed.
 virtual HRESULT STDMETHODCALLTYPE UpdateUI( void);

 //Called from MSHTML implementation of IOleInPlaceActiveObject::EnableModeless.
 //Also called when MSHTML displays modal UI.
 virtual HRESULT STDMETHODCALLTYPE EnableModeless(/* [in] */ VARIANT_BOOL fEnable);

 //Called from MSHTML implementation of IOleInPlaceActiveObject::OnDocWindowActivate.
 virtual HRESULT STDMETHODCALLTYPE OnDocWindowActivate(/* [in] */ VARIANT_BOOL fActivate);

 //Called from MSHTML implementation of IOleInPlaceActiveObject::OnFrameWindowActivate.
 virtual HRESULT STDMETHODCALLTYPE OnFrameWindowActivate(/* [in] */ VARIANT_BOOL fActivate);

 //Called from MSHTML implementation of IOleInPlaceActiveObject::ResizeBorder.
 virtual HRESULT STDMETHODCALLTYPE ResizeBorder(
  /* [in] */ long left,
  /* [in] */ long top,
  /* [in] */ long right,
  /* [in] */ long bottom,
  /* [in] */ IUnknown *pUIWindow,
  /* [in] */ VARIANT_BOOL fFrameWindow);

 //Called by MSHTML when IOleInPlaceActiveObject::TranslateAccelerator or
 //IOleControlSite::TranslateAccelerator is called.
 virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(
  /* [in] */ DWORD_PTR hWnd,
  /* [in] */ DWORD nMessage,
  /* [in] */ DWORD_PTR wParam,
  /* [in] */ DWORD_PTR lParam,
  /* [in] */ BSTR bstrGuidCmdGroup,
  /* [in] */ DWORD nCmdID,
  /* [retval][out] */ HRESULT *dwRetVal);

 //Returns the registry key under which MSHTML stores user preferences.
 virtual HRESULT STDMETHODCALLTYPE GetOptionKeyPath(/* [out] */ BSTR *pbstrKey, /* [in] */ DWORD dw);

 //Called by MSHTML when it is being used as a drop target to allow the host to supply an alternative IDropTarget.
 virtual HRESULT STDMETHODCALLTYPE GetDropTarget(
  /* [in] */ IUnknown *pDropTarget,
  /* [out] */ IUnknown **ppDropTarget);

 //Called by MSHTML to obtain the host's IDispatch interface.
 virtual HRESULT STDMETHODCALLTYPE GetExternal(/* [out] */ IDispatch **ppDispatch);
   
 //Called by MSHTML to allow the host an opportunity to modify the URL to be loaded.
 virtual HRESULT STDMETHODCALLTYPE TranslateUrl(
  /* [in] */ DWORD dwTranslate,
  /* [in] */ BSTR bstrURLIn,
  /* [out] */ BSTR *pbstrURLOut);

 //Called on the host by MSHTML to allow the host to replace MSHTML's data object.
 virtual HRESULT STDMETHODCALLTYPE FilterDataObject(
  /* [in] */ IUnknown *pDO,
  /* [out] */ IUnknown **ppDORet);

public:
    virtual HRESULT STDMETHODCALLTYPE SetSecuritySite(IInternetSecurityMgrSite* pSite);

    virtual HRESULT STDMETHODCALLTYPE GetSecuritySite(IInternetSecurityMgrSite** ppSite);

    virtual HRESULT STDMETHODCALLTYPE MapUrlToZone(LPCWSTR pwszUrl,
        DWORD* pdwZone, DWORD dwFlags);

    virtual HRESULT STDMETHODCALLTYPE GetSecurityId(LPCWSTR pwszUrl,
        BYTE* pbSecurityId, DWORD* pcbSecurityId, DWORD_PTR dwReserved);

    virtual HRESULT STDMETHODCALLTYPE ProcessUrlAction(
        /* [in] */ LPCWSTR pwszUrl,
        /* [in] */ DWORD dwAction,
        /* [size_is][out] */ BYTE __RPC_FAR *pPolicy,
        /* [in] */ DWORD cbPolicy,
        /* [in] */ BYTE __RPC_FAR *pContext,
        /* [in] */ DWORD cbContext,
        /* [in] */ DWORD dwFlags,
        /* [in] */ DWORD dwReserved = 0);

    virtual HRESULT STDMETHODCALLTYPE QueryCustomPolicy(LPCWSTR pwszUrl,
        REFGUID guidKey, BYTE** ppPolicy, DWORD* pcbPolicy,
        BYTE* pContext, DWORD cbContext, DWORD dwReserved);

    virtual HRESULT STDMETHODCALLTYPE SetZoneMapping(DWORD dwZone,
        LPCWSTR lpszPattern, DWORD dwFlags);

    virtual HRESULT STDMETHODCALLTYPE GetZoneMappings(DWORD dwZone,
        IEnumString  **ppenumString, DWORD dwFlags);

public:
    virtual HRESULT STDMETHODCALLTYPE OnControlInfoChanged( void);

    virtual HRESULT STDMETHODCALLTYPE LockInPlaceActive(
        /* [in] */ BOOL fLock);

    virtual HRESULT STDMETHODCALLTYPE GetExtendedControl(
        /* [out] */ IDispatch **ppDisp);

    virtual HRESULT STDMETHODCALLTYPE TransformCoords(
        /* [out][in] */ POINTL *pPtlHimetric,
        /* [out][in] */ POINTF *pPtfContainer,
        /* [in] */ DWORD dwFlags);

    virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(
        /* [in] */ MSG *pMsg,
        /* [in] */ DWORD grfModifiers);

    virtual HRESULT STDMETHODCALLTYPE OnFocus(
        /* [in] */ BOOL fGotFocus);

    virtual HRESULT STDMETHODCALLTYPE ShowPropertyFrame( void);
public:
   STDMETHOD(QueryService)( REFGUID guidService, 
                              REFIID riid,
                              void** ppvObject);
public:
 // IOleCommandTarget Methods
 virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE QueryStatus(
  /* [unique][in] */ const GUID *pguidCmdGroup,
  /* [in] */ ULONG cCmds,
  /* [out][in][size_is] */ OLECMD prgCmds[  ],
  /* [unique][out][in] */ OLECMDTEXT *pCmdText);

 virtual HRESULT STDMETHODCALLTYPE Exec(
  /* [unique][in] */ const GUID *pguidCmdGroup,
  /* [in] */ DWORD nCmdID,
  /* [in] */ DWORD nCmdexecopt,
  /* [unique][in] */ VARIANT *pvaIn,
  /* [unique][out][in] */ VARIANT *pvaOut);

// IOleContainer
 STDMETHOD(ParseDisplayName)(IBindCtx* /*pbc*/, LPOLESTR /*pszDisplayName*/, ULONG* /*pchEaten*/, IMoniker** /*ppmkOut*/);
 STDMETHOD(EnumObjects)(DWORD grfFlags, IEnumUnknown** ppenum);
 STDMETHOD(LockContainer)(BOOL fLock);

public:
 _bstr_t m_bszOptionKeyPath;
 ie_browser_dlg *m_pSimpleBrowser;
 IDispatchPtr m_spExternal;
protected:
    IInternetSecurityManager* m_pSecurityMgr;
};

一枚程序的主页 一枚程序 | 初学一级 | 园豆:108
提问于:2012-07-24 16:54
< >
分享
最佳答案
0

大致也就是一个对浏览器控件的封装,接管了一些浏览器事件。

收获园豆:10
Launcher | 高人七级 |园豆:45040 | 2012-07-24 17:05

soga,very thanks

一枚程序 | 园豆:108 (初学一级) | 2012-07-24 17:26
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册