00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #pragma once
00023
00024 class CCoolMenu;
00025
00026
00027 class CWebCtrl : public CWnd
00028 {
00029
00030 public:
00031 CWebCtrl();
00032 virtual ~CWebCtrl();
00033 DECLARE_DYNAMIC(CWebCtrl)
00034
00035
00036 public:
00037 BOOL Create(DWORD dwStyle, CWnd* pParentWnd, UINT nID = AFX_IDW_PANE_FIRST);
00038 void EnableCoolMenu(BOOL bEnable = TRUE);
00039 void EnableSandbox(BOOL bSandbox = TRUE);
00040 void SetExternal(IDispatch* pDispatch);
00041 HRESULT Navigate(LPCTSTR lpszURL, DWORD dwFlags = 0, LPCTSTR lpszTargetFrameName = NULL, LPCTSTR lpszHeaders = NULL, LPVOID lpvPostData = NULL, DWORD dwPostDataLen = 0);
00042
00043
00044 protected:
00045 CWnd m_wndBrowser;
00046 CComPtr<IWebBrowser2> m_pBrowser;
00047 CComPtr<IDispatch> m_pExternal;
00048 BOOL m_bSandbox;
00049 DWORD m_tFrame;
00050
00051
00052 protected:
00053 DECLARE_MESSAGE_MAP()
00054 virtual BOOL PreTranslateMessage(MSG* pMsg);
00055 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00056 afx_msg void OnDestroy();
00057 afx_msg void OnSize(UINT nType, int cx, int cy);
00058 afx_msg void OnPaint();
00059
00060
00061 protected:
00062 void EnterMenu(POINT* pPoint);
00063 static LRESULT PASCAL WebWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
00064 protected:
00065 CCoolMenu* m_pMenu;
00066 HWND m_hWndThis;
00067 WNDPROC m_pWndProc;
00068 static CWebCtrl* m_pThis;
00069
00070
00071 protected:
00072 DECLARE_EVENTSINK_MAP()
00073 virtual void BeforeNavigate2(LPDISPATCH pDispatch, VARIANT* pvURL, VARIANT* pvFlags, VARIANT* pvTargetFrameName, VARIANT* pvPostData, VARIANT* pvHeaders, VARIANT_BOOL* pvCancel);
00074 virtual void OnNewWindow2(LPDISPATCH* ppDisp, VARIANT_BOOL* bCancel);
00075
00076
00077 protected:
00078 class DocSite : public COleControlSite
00079 {
00080 public:
00081 DocSite(CWebCtrl* pCtrl, COleControlContainer* pParentWnd);
00082 CWebCtrl* GetCtrl() const { return m_pCtrl; }
00083 CWebCtrl* m_pCtrl;
00084 protected:
00085 DECLARE_INTERFACE_MAP()
00086 BEGIN_INTERFACE_PART(DocHostUIHandler, IDocHostUIHandler)
00087 STDMETHOD(ShowContextMenu)(DWORD, LPPOINT, LPUNKNOWN, LPDISPATCH);
00088 STDMETHOD(GetHostInfo)(DOCHOSTUIINFO*);
00089 STDMETHOD(ShowUI)(DWORD, LPOLEINPLACEACTIVEOBJECT, LPOLECOMMANDTARGET, LPOLEINPLACEFRAME, LPOLEINPLACEUIWINDOW);
00090 STDMETHOD(HideUI)();
00091 STDMETHOD(UpdateUI)();
00092 STDMETHOD(EnableModeless)(BOOL);
00093 STDMETHOD(OnDocWindowActivate)(BOOL);
00094 STDMETHOD(OnFrameWindowActivate)(BOOL);
00095 STDMETHOD(ResizeBorder)(LPCRECT, LPOLEINPLACEUIWINDOW, BOOL);
00096 STDMETHOD(TranslateAccelerator)(LPMSG, const GUID*, DWORD);
00097 STDMETHOD(GetOptionKeyPath)(OLECHAR **, DWORD);
00098 STDMETHOD(GetDropTarget)(LPDROPTARGET, LPDROPTARGET*);
00099 STDMETHOD(GetExternal)(LPDISPATCH*);
00100 STDMETHOD(TranslateUrl)(DWORD, OLECHAR*, OLECHAR **);
00101 STDMETHOD(FilterDataObject)(LPDATAOBJECT , LPDATAOBJECT*);
00102 END_INTERFACE_PART(DocHostUIHandler)
00103 BEGIN_INTERFACE_PART(DocHostShowUI, IDocHostShowUI)
00104 STDMETHOD(ShowHelp)(HWND hwnd, LPOLESTR pszHelpFile, UINT uCommand, DWORD dwData, POINT ptMouse, IDispatch *pDispatchObjectHit);
00105 STDMETHOD(ShowMessage)(HWND hwnd, LPOLESTR lpstrText, LPOLESTR lpstrCaption, DWORD dwType, LPOLESTR lpstrHelpFile, DWORD dwHelpContext, LRESULT *plResult);
00106 END_INTERFACE_PART(DocHostShowUI)
00107 BEGIN_INTERFACE_PART(ServiceProvider, IServiceProvider)
00108 STDMETHOD(QueryService)(REFGUID guidService, REFIID riid, void **ppv);
00109 END_INTERFACE_PART(ServiceProvider)
00110 BEGIN_INTERFACE_PART(InternetSecurityManager, IInternetSecurityManager)
00111 STDMETHOD(GetSecurityId)(LPCWSTR pwszUrl, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved);
00112 STDMETHOD(GetSecuritySite)(IInternetSecurityMgrSite **ppSite);
00113 STDMETHOD(GetZoneMappings)(DWORD dwZone, IEnumString **ppenumString, DWORD dwFlags);
00114 STDMETHOD(MapUrlToZone)(LPCWSTR pwszUrl, DWORD *pdwZone, DWORD dwFlags);
00115 STDMETHOD(ProcessUrlAction)(LPCWSTR pwszUrl, DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved);
00116 STDMETHOD(QueryCustomPolicy)(LPCWSTR pwszUrl, REFGUID guidKey, BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwReserved);
00117 STDMETHOD(SetSecuritySite)(IInternetSecurityMgrSite *pSite);
00118 STDMETHOD(SetZoneMapping)(DWORD dwZone, LPCWSTR lpszPattern, DWORD dwFlags);
00119 END_INTERFACE_PART(InternetSecurityManager)
00120 };
00121
00122 virtual BOOL CreateControlSite(COleControlContainer* pContainer, COleControlSite** ppSite, UINT nID, REFCLSID clsid);
00123 };
00124
00125 typedef struct
00126 {
00127 NMHDR hdr;
00128 DWORD dwMenuID;
00129 POINT ptMouse;
00130 IUnknown* pCmdTarget;
00131 IDispatch* pContext;
00132 } WVNCONTEXTMENU;
00133
00134 #define WVN_CONTEXTMENU 100