// IOleClientSite接口 函数
HRESULT STDMETHODCALLTYPE Site_QueryInterface(IOleClientSite FAR* This, REFIID riid, void ** ppvObject);
HRESULT STDMETHODCALLTYPE Site_AddRef(IOleClientSite FAR* This);
HRESULT STDMETHODCALLTYPE Site_Release(IOleClientSite FAR* This);
HRESULT STDMETHODCALLTYPE Site_SaveObject(IOleClientSite FAR* This);
HRESULT STDMETHODCALLTYPE Site_GetMoniker(IOleClientSite FAR* This, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker ** ppmk);
HRESULT STDMETHODCALLTYPE Site_GetContainer(IOleClientSite FAR* This, LPOLECONTAINER FAR* ppContainer);
HRESULT STDMETHODCALLTYPE Site_ShowObject(IOleClientSite FAR* This);
HRESULT STDMETHODCALLTYPE Site_OnShowWindow(IOleClientSite FAR* This, BOOL fShow);
HRESULT STDMETHODCALLTYPE Site_RequestNewObjectLayout(IOleClientSite FAR* This);
//用C语言实现虚表
IOleClientSiteVtbl MyIOleClientSiteTable = {Site_QueryInterface,
Site_AddRef,
Site_Release,
Site_SaveObject,
Site_GetMoniker,
Site_GetContainer,
Site_ShowObject,
Site_OnShowWindow,
Site_RequestNewObjectLayout};
_IOleClientSiteEx *_iOleClientSiteEx;
// 用 IOleClientSite 虚表指针初始化IOleClientSite 对象
_iOleClientSiteEx = (_IOleClientSiteEx *)(ptr + sizeof(IOleInPlaceFrameEx) + sizeof(IOleObject *));
_iOleClientSiteEx->client.lpVtbl = &MyIOleClientSiteTable;
我的问题是 如何用C语言实现实现webbrowers 的IDocHostUIHandler接口,IDocHostUIHandler这个接口都有那些函数?
5 个解决方案
#1
问题进了一步:
#include <MsHtmHst.h>
// IDocHostUIHandler 接口函数
HRESULT STDMETHODCALLTYPE DocHostUI_QueryInterface(IDocHostUIHandler * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject);
HRESULT STDMETHODCALLTYPE DocHostUI_AddRef(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_Release(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_ShowContextMenu(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ POINT *ppt,
/* [in] */ IUnknown *pcmdtReserved,
/* [in] */ IDispatch *pdispReserved);
HRESULT STDMETHODCALLTYPE DocHostUI_GetHostInfo(IDocHostUIHandler * This,
/* [out][in] */ DOCHOSTUIINFO *pInfo);
HRESULT STDMETHODCALLTYPE DocHostUI_ShowUI(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ IOleInPlaceActiveObject *pActiveObject,
/* [in] */ IOleCommandTarget *pCommandTarget,
/* [in] */ IOleInPlaceFrame *pFrame,
/* [in] */ IOleInPlaceUIWindow *pDoc);
HRESULT STDMETHODCALLTYPE DocHostUI_HideUI(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_UpdateUI(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_EnableModeless(IDocHostUIHandler * This,
/* [in] */ BOOL fEnable);
HRESULT STDMETHODCALLTYPE DocHostUI_OnDocWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate);
HRESULT STDMETHODCALLTYPE DocHostUI_OnFrameWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate);
HRESULT STDMETHODCALLTYPE DocHostUI_ResizeBorder(IDocHostUIHandler * This,
/* [in] */ LPCRECT prcBorder,
/* [in] */ IOleInPlaceUIWindow *pUIWindow,
/* [in] */ BOOL fRameWindow);
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateAccelerator(IDocHostUIHandler * This,
/* [in] */ LPMSG lpMsg,
/* [in] */ const GUID *pguidCmdGroup,
/* [in] */ DWORD nCmdID);
HRESULT STDMETHODCALLTYPE DocHostUI_GetOptionKeyPath(IDocHostUIHandler * This,
/* [out] */ LPOLESTR *pchKey,
/* [in] */ DWORD dw);
HRESULT STDMETHODCALLTYPE DocHostUI_GetDropTarget(IDocHostUIHandler * This,
/* [in] */ IDropTarget *pDropTarget,
/* [out] */ IDropTarget **ppDropTarget);
HRESULT STDMETHODCALLTYPE DocHostUI_GetExternal(IDocHostUIHandler * This,
/* [out] */ IDispatch **ppDispatch);
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateUrl(IDocHostUIHandler * This,
/* [in] */ DWORD dwTranslate,
/* [in] */ OLECHAR *pchURLIn,
/* [out] */ OLECHAR **ppchURLOut);
HRESULT STDMETHODCALLTYPE DocHostUI_FilterDataObject(IDocHostUIHandler * This,
/* [in] */ IDataObject *pDO,
/* [out] */ IDataObject **ppDORet);
//用C语言实现虚表
IDocHostUIHandlerVtbl MyIDocHostUIHandlerVtbl = {DocHostUI_QueryInterface,
DocHostUI_AddRef,
DocHostUI_Release,
DocHostUI_ShowContextMenu,
DocHostUI_GetHostInfo,
DocHostUI_ShowUI,
DocHostUI_HideUI,
DocHostUI_UpdateUI,
DocHostUI_EnableModeless,
DocHostUI_OnDocWindowActivate,
DocHostUI_OnFrameWindowActivate,
DocHostUI_ResizeBorder,
DocHostUI_TranslateAccelerator,
DocHostUI_GetOptionKeyPath,
DocHostUI_GetDropTarget,
DocHostUI_GetExternal,
DocHostUI_TranslateUrl,
DocHostUI_FilterDataObject
};
#include <MsHtmHst.h>
// IDocHostUIHandler 接口函数
HRESULT STDMETHODCALLTYPE DocHostUI_QueryInterface(IDocHostUIHandler * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject);
HRESULT STDMETHODCALLTYPE DocHostUI_AddRef(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_Release(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_ShowContextMenu(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ POINT *ppt,
/* [in] */ IUnknown *pcmdtReserved,
/* [in] */ IDispatch *pdispReserved);
HRESULT STDMETHODCALLTYPE DocHostUI_GetHostInfo(IDocHostUIHandler * This,
/* [out][in] */ DOCHOSTUIINFO *pInfo);
HRESULT STDMETHODCALLTYPE DocHostUI_ShowUI(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ IOleInPlaceActiveObject *pActiveObject,
/* [in] */ IOleCommandTarget *pCommandTarget,
/* [in] */ IOleInPlaceFrame *pFrame,
/* [in] */ IOleInPlaceUIWindow *pDoc);
HRESULT STDMETHODCALLTYPE DocHostUI_HideUI(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_UpdateUI(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_EnableModeless(IDocHostUIHandler * This,
/* [in] */ BOOL fEnable);
HRESULT STDMETHODCALLTYPE DocHostUI_OnDocWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate);
HRESULT STDMETHODCALLTYPE DocHostUI_OnFrameWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate);
HRESULT STDMETHODCALLTYPE DocHostUI_ResizeBorder(IDocHostUIHandler * This,
/* [in] */ LPCRECT prcBorder,
/* [in] */ IOleInPlaceUIWindow *pUIWindow,
/* [in] */ BOOL fRameWindow);
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateAccelerator(IDocHostUIHandler * This,
/* [in] */ LPMSG lpMsg,
/* [in] */ const GUID *pguidCmdGroup,
/* [in] */ DWORD nCmdID);
HRESULT STDMETHODCALLTYPE DocHostUI_GetOptionKeyPath(IDocHostUIHandler * This,
/* [out] */ LPOLESTR *pchKey,
/* [in] */ DWORD dw);
HRESULT STDMETHODCALLTYPE DocHostUI_GetDropTarget(IDocHostUIHandler * This,
/* [in] */ IDropTarget *pDropTarget,
/* [out] */ IDropTarget **ppDropTarget);
HRESULT STDMETHODCALLTYPE DocHostUI_GetExternal(IDocHostUIHandler * This,
/* [out] */ IDispatch **ppDispatch);
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateUrl(IDocHostUIHandler * This,
/* [in] */ DWORD dwTranslate,
/* [in] */ OLECHAR *pchURLIn,
/* [out] */ OLECHAR **ppchURLOut);
HRESULT STDMETHODCALLTYPE DocHostUI_FilterDataObject(IDocHostUIHandler * This,
/* [in] */ IDataObject *pDO,
/* [out] */ IDataObject **ppDORet);
//用C语言实现虚表
IDocHostUIHandlerVtbl MyIDocHostUIHandlerVtbl = {DocHostUI_QueryInterface,
DocHostUI_AddRef,
DocHostUI_Release,
DocHostUI_ShowContextMenu,
DocHostUI_GetHostInfo,
DocHostUI_ShowUI,
DocHostUI_HideUI,
DocHostUI_UpdateUI,
DocHostUI_EnableModeless,
DocHostUI_OnDocWindowActivate,
DocHostUI_OnFrameWindowActivate,
DocHostUI_ResizeBorder,
DocHostUI_TranslateAccelerator,
DocHostUI_GetOptionKeyPath,
DocHostUI_GetDropTarget,
DocHostUI_GetExternal,
DocHostUI_TranslateUrl,
DocHostUI_FilterDataObject
};
#2
接上面
// IDocHostUIHandler 接口函数 的实现
HRESULT STDMETHODCALLTYPE DocHostUI_QueryInterface(IDocHostUIHandler * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_AddRef(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_Release(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowContextMenu(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ POINT *ppt,
/* [in] */ IUnknown *pcmdtReserved,
/* [in] */ IDispatch *pdispReserved)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetHostInfo(IDocHostUIHandler * This,
/* [out][in] */ DOCHOSTUIINFO *pInfo)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowUI(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ IOleInPlaceActiveObject *pActiveObject,
/* [in] */ IOleCommandTarget *pCommandTarget,
/* [in] */ IOleInPlaceFrame *pFrame,
/* [in] */ IOleInPlaceUIWindow *pDoc)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_HideUI(IDocHostUIHandler * This)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_UpdateUI(IDocHostUIHandler * This)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_EnableModeless(IDocHostUIHandler * This,
/* [in] */ BOOL fEnable)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnDocWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnFrameWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ResizeBorder(IDocHostUIHandler * This,
/* [in] */ LPCRECT prcBorder,
/* [in] */ IOleInPlaceUIWindow *pUIWindow,
/* [in] */ BOOL fRameWindow)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateAccelerator(IDocHostUIHandler * This,
/* [in] */ LPMSG lpMsg,
/* [in] */ const GUID *pguidCmdGroup,
/* [in] */ DWORD nCmdID)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetOptionKeyPath(IDocHostUIHandler * This,
/* [out] */ LPOLESTR *pchKey,
/* [in] */ DWORD dw)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetDropTarget(IDocHostUIHandler * This,
/* [in] */ IDropTarget *pDropTarget,
/* [out] */ IDropTarget **ppDropTarget)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetExternal(IDocHostUIHandler * This,
/* [out] */ IDispatch **ppDispatch)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateUrl(IDocHostUIHandler * This,
/* [in] */ DWORD dwTranslate,
/* [in] */ OLECHAR *pchURLIn,
/* [out] */ OLECHAR **ppchURLOut)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_FilterDataObject(IDocHostUIHandler * This,
/* [in] */ IDataObject *pDO,
/* [out] */ IDataObject **ppDORet)
{
return(S_OK);
}
上面的代码编译连接通过
现在的问题是: 1.每个接口函数的返回值.该如何确定.看例子有的返回S_OK,有的返回1,有的返回NOTIMPLEMENTED
依据是什么,或者说需要看什么文挡
2.QueryInterface和GetHostInfo的代码如何写.
3.这个接口的函数GetHostInfo是自己写的程序调用,还是IE调用.如何是自己写的程序调用,在什么情
况下调用.
// IDocHostUIHandler 接口函数 的实现
HRESULT STDMETHODCALLTYPE DocHostUI_QueryInterface(IDocHostUIHandler * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_AddRef(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_Release(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowContextMenu(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ POINT *ppt,
/* [in] */ IUnknown *pcmdtReserved,
/* [in] */ IDispatch *pdispReserved)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetHostInfo(IDocHostUIHandler * This,
/* [out][in] */ DOCHOSTUIINFO *pInfo)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowUI(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ IOleInPlaceActiveObject *pActiveObject,
/* [in] */ IOleCommandTarget *pCommandTarget,
/* [in] */ IOleInPlaceFrame *pFrame,
/* [in] */ IOleInPlaceUIWindow *pDoc)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_HideUI(IDocHostUIHandler * This)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_UpdateUI(IDocHostUIHandler * This)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_EnableModeless(IDocHostUIHandler * This,
/* [in] */ BOOL fEnable)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnDocWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnFrameWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ResizeBorder(IDocHostUIHandler * This,
/* [in] */ LPCRECT prcBorder,
/* [in] */ IOleInPlaceUIWindow *pUIWindow,
/* [in] */ BOOL fRameWindow)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateAccelerator(IDocHostUIHandler * This,
/* [in] */ LPMSG lpMsg,
/* [in] */ const GUID *pguidCmdGroup,
/* [in] */ DWORD nCmdID)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetOptionKeyPath(IDocHostUIHandler * This,
/* [out] */ LPOLESTR *pchKey,
/* [in] */ DWORD dw)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetDropTarget(IDocHostUIHandler * This,
/* [in] */ IDropTarget *pDropTarget,
/* [out] */ IDropTarget **ppDropTarget)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetExternal(IDocHostUIHandler * This,
/* [out] */ IDispatch **ppDispatch)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateUrl(IDocHostUIHandler * This,
/* [in] */ DWORD dwTranslate,
/* [in] */ OLECHAR *pchURLIn,
/* [out] */ OLECHAR **ppchURLOut)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_FilterDataObject(IDocHostUIHandler * This,
/* [in] */ IDataObject *pDO,
/* [out] */ IDataObject **ppDORet)
{
return(S_OK);
}
上面的代码编译连接通过
现在的问题是: 1.每个接口函数的返回值.该如何确定.看例子有的返回S_OK,有的返回1,有的返回NOTIMPLEMENTED
依据是什么,或者说需要看什么文挡
2.QueryInterface和GetHostInfo的代码如何写.
3.这个接口的函数GetHostInfo是自己写的程序调用,还是IE调用.如何是自己写的程序调用,在什么情
况下调用.
#3
HRESULT STDMETHODCALLTYPE DocHostUI_GetHostInfo(IDocHostUIHandler * This,
/* [out][in] */ DOCHOSTUIINFO *pInfo)
{
pInfo->dwFlags |= DOCHOSTUIFLAG_NO3DBORDER;/*DOCHOSTUIFLAG_NO3DBORDER = 4; */
pInfo->dwFlags |= DOCHOSTUIFLAG_SCROLL_NO;/*DOCHOSTUIFLAG_SCROLL_NO = 8;*/
return(S_OK);
}
/* [out][in] */ DOCHOSTUIINFO *pInfo)
{
pInfo->dwFlags |= DOCHOSTUIFLAG_NO3DBORDER;/*DOCHOSTUIFLAG_NO3DBORDER = 4; */
pInfo->dwFlags |= DOCHOSTUIFLAG_SCROLL_NO;/*DOCHOSTUIFLAG_SCROLL_NO = 8;*/
return(S_OK);
}
#4
强!!看看
#5
// IDocHostUIHandler 接口函数 的实现
HRESULT STDMETHODCALLTYPE DocHostUI_QueryInterface(IDocHostUIHandler * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_AddRef(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_Release(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowContextMenu(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ POINT *ppt,
/* [in] */ IUnknown *pcmdtReserved,
/* [in] */ IDispatch *pdispReserved)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetHostInfo(IDocHostUIHandler * This,
/* [out][in] */ DOCHOSTUIINFO *pInfo)
{
//去掉3D边框
pInfo->dwFlags |= DOCHOSTUIFLAG_NO3DBORDER;/*DOCHOSTUIFLAG_NO3DBORDER = 4; */
//去掉滚动条
pInfo->dwFlags |= DOCHOSTUIFLAG_SCROLL_NO;/*DOCHOSTUIFLAG_SCROLL_NO = 8;*/
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowUI(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ IOleInPlaceActiveObject *pActiveObject,
/* [in] */ IOleCommandTarget *pCommandTarget,
/* [in] */ IOleInPlaceFrame *pFrame,
/* [in] */ IOleInPlaceUIWindow *pDoc)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_HideUI(IDocHostUIHandler * This)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_UpdateUI(IDocHostUIHandler * This)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_EnableModeless(IDocHostUIHandler * This,
/* [in] */ BOOL fEnable)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnDocWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnFrameWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_ResizeBorder(IDocHostUIHandler * This,
/* [in] */ LPCRECT prcBorder,
/* [in] */ IOleInPlaceUIWindow *pUIWindow,
/* [in] */ BOOL fRameWindow)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateAccelerator(IDocHostUIHandler * This,
/* [in] */ LPMSG lpMsg,
/* [in] */ const GUID *pguidCmdGroup,
/* [in] */ DWORD nCmdID)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetOptionKeyPath(IDocHostUIHandler * This,
/* [out] */ LPOLESTR *pchKey,
/* [in] */ DWORD dw)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetDropTarget(IDocHostUIHandler * This,
/* [in] */ IDropTarget *pDropTarget,
/* [out] */ IDropTarget **ppDropTarget)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetExternal(IDocHostUIHandler * This,
/* [out] */ IDispatch **ppDispatch)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateUrl(IDocHostUIHandler * This,
/* [in] */ DWORD dwTranslate,
/* [in] */ OLECHAR *pchURLIn,
/* [out] */ OLECHAR **ppchURLOut)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_FilterDataObject(IDocHostUIHandler * This,
/* [in] */ IDataObject *pDO,
/* [out] */ IDataObject **ppDORet)
{
NOTIMPLEMENTED;
}
目前的问题是 QueryInterface如何写.
这个接口的函数GetHostInfo是自己写的程序调用,还是IE调用.如何是自己写的程序调用,在什么情 况下调用.
HRESULT STDMETHODCALLTYPE DocHostUI_QueryInterface(IDocHostUIHandler * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_AddRef(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_Release(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowContextMenu(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ POINT *ppt,
/* [in] */ IUnknown *pcmdtReserved,
/* [in] */ IDispatch *pdispReserved)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetHostInfo(IDocHostUIHandler * This,
/* [out][in] */ DOCHOSTUIINFO *pInfo)
{
//去掉3D边框
pInfo->dwFlags |= DOCHOSTUIFLAG_NO3DBORDER;/*DOCHOSTUIFLAG_NO3DBORDER = 4; */
//去掉滚动条
pInfo->dwFlags |= DOCHOSTUIFLAG_SCROLL_NO;/*DOCHOSTUIFLAG_SCROLL_NO = 8;*/
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowUI(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ IOleInPlaceActiveObject *pActiveObject,
/* [in] */ IOleCommandTarget *pCommandTarget,
/* [in] */ IOleInPlaceFrame *pFrame,
/* [in] */ IOleInPlaceUIWindow *pDoc)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_HideUI(IDocHostUIHandler * This)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_UpdateUI(IDocHostUIHandler * This)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_EnableModeless(IDocHostUIHandler * This,
/* [in] */ BOOL fEnable)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnDocWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnFrameWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_ResizeBorder(IDocHostUIHandler * This,
/* [in] */ LPCRECT prcBorder,
/* [in] */ IOleInPlaceUIWindow *pUIWindow,
/* [in] */ BOOL fRameWindow)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateAccelerator(IDocHostUIHandler * This,
/* [in] */ LPMSG lpMsg,
/* [in] */ const GUID *pguidCmdGroup,
/* [in] */ DWORD nCmdID)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetOptionKeyPath(IDocHostUIHandler * This,
/* [out] */ LPOLESTR *pchKey,
/* [in] */ DWORD dw)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetDropTarget(IDocHostUIHandler * This,
/* [in] */ IDropTarget *pDropTarget,
/* [out] */ IDropTarget **ppDropTarget)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetExternal(IDocHostUIHandler * This,
/* [out] */ IDispatch **ppDispatch)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateUrl(IDocHostUIHandler * This,
/* [in] */ DWORD dwTranslate,
/* [in] */ OLECHAR *pchURLIn,
/* [out] */ OLECHAR **ppchURLOut)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_FilterDataObject(IDocHostUIHandler * This,
/* [in] */ IDataObject *pDO,
/* [out] */ IDataObject **ppDORet)
{
NOTIMPLEMENTED;
}
目前的问题是 QueryInterface如何写.
这个接口的函数GetHostInfo是自己写的程序调用,还是IE调用.如何是自己写的程序调用,在什么情 况下调用.
#1
问题进了一步:
#include <MsHtmHst.h>
// IDocHostUIHandler 接口函数
HRESULT STDMETHODCALLTYPE DocHostUI_QueryInterface(IDocHostUIHandler * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject);
HRESULT STDMETHODCALLTYPE DocHostUI_AddRef(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_Release(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_ShowContextMenu(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ POINT *ppt,
/* [in] */ IUnknown *pcmdtReserved,
/* [in] */ IDispatch *pdispReserved);
HRESULT STDMETHODCALLTYPE DocHostUI_GetHostInfo(IDocHostUIHandler * This,
/* [out][in] */ DOCHOSTUIINFO *pInfo);
HRESULT STDMETHODCALLTYPE DocHostUI_ShowUI(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ IOleInPlaceActiveObject *pActiveObject,
/* [in] */ IOleCommandTarget *pCommandTarget,
/* [in] */ IOleInPlaceFrame *pFrame,
/* [in] */ IOleInPlaceUIWindow *pDoc);
HRESULT STDMETHODCALLTYPE DocHostUI_HideUI(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_UpdateUI(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_EnableModeless(IDocHostUIHandler * This,
/* [in] */ BOOL fEnable);
HRESULT STDMETHODCALLTYPE DocHostUI_OnDocWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate);
HRESULT STDMETHODCALLTYPE DocHostUI_OnFrameWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate);
HRESULT STDMETHODCALLTYPE DocHostUI_ResizeBorder(IDocHostUIHandler * This,
/* [in] */ LPCRECT prcBorder,
/* [in] */ IOleInPlaceUIWindow *pUIWindow,
/* [in] */ BOOL fRameWindow);
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateAccelerator(IDocHostUIHandler * This,
/* [in] */ LPMSG lpMsg,
/* [in] */ const GUID *pguidCmdGroup,
/* [in] */ DWORD nCmdID);
HRESULT STDMETHODCALLTYPE DocHostUI_GetOptionKeyPath(IDocHostUIHandler * This,
/* [out] */ LPOLESTR *pchKey,
/* [in] */ DWORD dw);
HRESULT STDMETHODCALLTYPE DocHostUI_GetDropTarget(IDocHostUIHandler * This,
/* [in] */ IDropTarget *pDropTarget,
/* [out] */ IDropTarget **ppDropTarget);
HRESULT STDMETHODCALLTYPE DocHostUI_GetExternal(IDocHostUIHandler * This,
/* [out] */ IDispatch **ppDispatch);
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateUrl(IDocHostUIHandler * This,
/* [in] */ DWORD dwTranslate,
/* [in] */ OLECHAR *pchURLIn,
/* [out] */ OLECHAR **ppchURLOut);
HRESULT STDMETHODCALLTYPE DocHostUI_FilterDataObject(IDocHostUIHandler * This,
/* [in] */ IDataObject *pDO,
/* [out] */ IDataObject **ppDORet);
//用C语言实现虚表
IDocHostUIHandlerVtbl MyIDocHostUIHandlerVtbl = {DocHostUI_QueryInterface,
DocHostUI_AddRef,
DocHostUI_Release,
DocHostUI_ShowContextMenu,
DocHostUI_GetHostInfo,
DocHostUI_ShowUI,
DocHostUI_HideUI,
DocHostUI_UpdateUI,
DocHostUI_EnableModeless,
DocHostUI_OnDocWindowActivate,
DocHostUI_OnFrameWindowActivate,
DocHostUI_ResizeBorder,
DocHostUI_TranslateAccelerator,
DocHostUI_GetOptionKeyPath,
DocHostUI_GetDropTarget,
DocHostUI_GetExternal,
DocHostUI_TranslateUrl,
DocHostUI_FilterDataObject
};
#include <MsHtmHst.h>
// IDocHostUIHandler 接口函数
HRESULT STDMETHODCALLTYPE DocHostUI_QueryInterface(IDocHostUIHandler * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject);
HRESULT STDMETHODCALLTYPE DocHostUI_AddRef(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_Release(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_ShowContextMenu(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ POINT *ppt,
/* [in] */ IUnknown *pcmdtReserved,
/* [in] */ IDispatch *pdispReserved);
HRESULT STDMETHODCALLTYPE DocHostUI_GetHostInfo(IDocHostUIHandler * This,
/* [out][in] */ DOCHOSTUIINFO *pInfo);
HRESULT STDMETHODCALLTYPE DocHostUI_ShowUI(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ IOleInPlaceActiveObject *pActiveObject,
/* [in] */ IOleCommandTarget *pCommandTarget,
/* [in] */ IOleInPlaceFrame *pFrame,
/* [in] */ IOleInPlaceUIWindow *pDoc);
HRESULT STDMETHODCALLTYPE DocHostUI_HideUI(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_UpdateUI(IDocHostUIHandler * This);
HRESULT STDMETHODCALLTYPE DocHostUI_EnableModeless(IDocHostUIHandler * This,
/* [in] */ BOOL fEnable);
HRESULT STDMETHODCALLTYPE DocHostUI_OnDocWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate);
HRESULT STDMETHODCALLTYPE DocHostUI_OnFrameWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate);
HRESULT STDMETHODCALLTYPE DocHostUI_ResizeBorder(IDocHostUIHandler * This,
/* [in] */ LPCRECT prcBorder,
/* [in] */ IOleInPlaceUIWindow *pUIWindow,
/* [in] */ BOOL fRameWindow);
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateAccelerator(IDocHostUIHandler * This,
/* [in] */ LPMSG lpMsg,
/* [in] */ const GUID *pguidCmdGroup,
/* [in] */ DWORD nCmdID);
HRESULT STDMETHODCALLTYPE DocHostUI_GetOptionKeyPath(IDocHostUIHandler * This,
/* [out] */ LPOLESTR *pchKey,
/* [in] */ DWORD dw);
HRESULT STDMETHODCALLTYPE DocHostUI_GetDropTarget(IDocHostUIHandler * This,
/* [in] */ IDropTarget *pDropTarget,
/* [out] */ IDropTarget **ppDropTarget);
HRESULT STDMETHODCALLTYPE DocHostUI_GetExternal(IDocHostUIHandler * This,
/* [out] */ IDispatch **ppDispatch);
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateUrl(IDocHostUIHandler * This,
/* [in] */ DWORD dwTranslate,
/* [in] */ OLECHAR *pchURLIn,
/* [out] */ OLECHAR **ppchURLOut);
HRESULT STDMETHODCALLTYPE DocHostUI_FilterDataObject(IDocHostUIHandler * This,
/* [in] */ IDataObject *pDO,
/* [out] */ IDataObject **ppDORet);
//用C语言实现虚表
IDocHostUIHandlerVtbl MyIDocHostUIHandlerVtbl = {DocHostUI_QueryInterface,
DocHostUI_AddRef,
DocHostUI_Release,
DocHostUI_ShowContextMenu,
DocHostUI_GetHostInfo,
DocHostUI_ShowUI,
DocHostUI_HideUI,
DocHostUI_UpdateUI,
DocHostUI_EnableModeless,
DocHostUI_OnDocWindowActivate,
DocHostUI_OnFrameWindowActivate,
DocHostUI_ResizeBorder,
DocHostUI_TranslateAccelerator,
DocHostUI_GetOptionKeyPath,
DocHostUI_GetDropTarget,
DocHostUI_GetExternal,
DocHostUI_TranslateUrl,
DocHostUI_FilterDataObject
};
#2
接上面
// IDocHostUIHandler 接口函数 的实现
HRESULT STDMETHODCALLTYPE DocHostUI_QueryInterface(IDocHostUIHandler * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_AddRef(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_Release(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowContextMenu(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ POINT *ppt,
/* [in] */ IUnknown *pcmdtReserved,
/* [in] */ IDispatch *pdispReserved)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetHostInfo(IDocHostUIHandler * This,
/* [out][in] */ DOCHOSTUIINFO *pInfo)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowUI(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ IOleInPlaceActiveObject *pActiveObject,
/* [in] */ IOleCommandTarget *pCommandTarget,
/* [in] */ IOleInPlaceFrame *pFrame,
/* [in] */ IOleInPlaceUIWindow *pDoc)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_HideUI(IDocHostUIHandler * This)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_UpdateUI(IDocHostUIHandler * This)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_EnableModeless(IDocHostUIHandler * This,
/* [in] */ BOOL fEnable)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnDocWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnFrameWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ResizeBorder(IDocHostUIHandler * This,
/* [in] */ LPCRECT prcBorder,
/* [in] */ IOleInPlaceUIWindow *pUIWindow,
/* [in] */ BOOL fRameWindow)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateAccelerator(IDocHostUIHandler * This,
/* [in] */ LPMSG lpMsg,
/* [in] */ const GUID *pguidCmdGroup,
/* [in] */ DWORD nCmdID)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetOptionKeyPath(IDocHostUIHandler * This,
/* [out] */ LPOLESTR *pchKey,
/* [in] */ DWORD dw)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetDropTarget(IDocHostUIHandler * This,
/* [in] */ IDropTarget *pDropTarget,
/* [out] */ IDropTarget **ppDropTarget)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetExternal(IDocHostUIHandler * This,
/* [out] */ IDispatch **ppDispatch)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateUrl(IDocHostUIHandler * This,
/* [in] */ DWORD dwTranslate,
/* [in] */ OLECHAR *pchURLIn,
/* [out] */ OLECHAR **ppchURLOut)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_FilterDataObject(IDocHostUIHandler * This,
/* [in] */ IDataObject *pDO,
/* [out] */ IDataObject **ppDORet)
{
return(S_OK);
}
上面的代码编译连接通过
现在的问题是: 1.每个接口函数的返回值.该如何确定.看例子有的返回S_OK,有的返回1,有的返回NOTIMPLEMENTED
依据是什么,或者说需要看什么文挡
2.QueryInterface和GetHostInfo的代码如何写.
3.这个接口的函数GetHostInfo是自己写的程序调用,还是IE调用.如何是自己写的程序调用,在什么情
况下调用.
// IDocHostUIHandler 接口函数 的实现
HRESULT STDMETHODCALLTYPE DocHostUI_QueryInterface(IDocHostUIHandler * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_AddRef(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_Release(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowContextMenu(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ POINT *ppt,
/* [in] */ IUnknown *pcmdtReserved,
/* [in] */ IDispatch *pdispReserved)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetHostInfo(IDocHostUIHandler * This,
/* [out][in] */ DOCHOSTUIINFO *pInfo)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowUI(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ IOleInPlaceActiveObject *pActiveObject,
/* [in] */ IOleCommandTarget *pCommandTarget,
/* [in] */ IOleInPlaceFrame *pFrame,
/* [in] */ IOleInPlaceUIWindow *pDoc)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_HideUI(IDocHostUIHandler * This)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_UpdateUI(IDocHostUIHandler * This)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_EnableModeless(IDocHostUIHandler * This,
/* [in] */ BOOL fEnable)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnDocWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnFrameWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ResizeBorder(IDocHostUIHandler * This,
/* [in] */ LPCRECT prcBorder,
/* [in] */ IOleInPlaceUIWindow *pUIWindow,
/* [in] */ BOOL fRameWindow)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateAccelerator(IDocHostUIHandler * This,
/* [in] */ LPMSG lpMsg,
/* [in] */ const GUID *pguidCmdGroup,
/* [in] */ DWORD nCmdID)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetOptionKeyPath(IDocHostUIHandler * This,
/* [out] */ LPOLESTR *pchKey,
/* [in] */ DWORD dw)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetDropTarget(IDocHostUIHandler * This,
/* [in] */ IDropTarget *pDropTarget,
/* [out] */ IDropTarget **ppDropTarget)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetExternal(IDocHostUIHandler * This,
/* [out] */ IDispatch **ppDispatch)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateUrl(IDocHostUIHandler * This,
/* [in] */ DWORD dwTranslate,
/* [in] */ OLECHAR *pchURLIn,
/* [out] */ OLECHAR **ppchURLOut)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_FilterDataObject(IDocHostUIHandler * This,
/* [in] */ IDataObject *pDO,
/* [out] */ IDataObject **ppDORet)
{
return(S_OK);
}
上面的代码编译连接通过
现在的问题是: 1.每个接口函数的返回值.该如何确定.看例子有的返回S_OK,有的返回1,有的返回NOTIMPLEMENTED
依据是什么,或者说需要看什么文挡
2.QueryInterface和GetHostInfo的代码如何写.
3.这个接口的函数GetHostInfo是自己写的程序调用,还是IE调用.如何是自己写的程序调用,在什么情
况下调用.
#3
HRESULT STDMETHODCALLTYPE DocHostUI_GetHostInfo(IDocHostUIHandler * This,
/* [out][in] */ DOCHOSTUIINFO *pInfo)
{
pInfo->dwFlags |= DOCHOSTUIFLAG_NO3DBORDER;/*DOCHOSTUIFLAG_NO3DBORDER = 4; */
pInfo->dwFlags |= DOCHOSTUIFLAG_SCROLL_NO;/*DOCHOSTUIFLAG_SCROLL_NO = 8;*/
return(S_OK);
}
/* [out][in] */ DOCHOSTUIINFO *pInfo)
{
pInfo->dwFlags |= DOCHOSTUIFLAG_NO3DBORDER;/*DOCHOSTUIFLAG_NO3DBORDER = 4; */
pInfo->dwFlags |= DOCHOSTUIFLAG_SCROLL_NO;/*DOCHOSTUIFLAG_SCROLL_NO = 8;*/
return(S_OK);
}
#4
强!!看看
#5
// IDocHostUIHandler 接口函数 的实现
HRESULT STDMETHODCALLTYPE DocHostUI_QueryInterface(IDocHostUIHandler * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_AddRef(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_Release(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowContextMenu(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ POINT *ppt,
/* [in] */ IUnknown *pcmdtReserved,
/* [in] */ IDispatch *pdispReserved)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetHostInfo(IDocHostUIHandler * This,
/* [out][in] */ DOCHOSTUIINFO *pInfo)
{
//去掉3D边框
pInfo->dwFlags |= DOCHOSTUIFLAG_NO3DBORDER;/*DOCHOSTUIFLAG_NO3DBORDER = 4; */
//去掉滚动条
pInfo->dwFlags |= DOCHOSTUIFLAG_SCROLL_NO;/*DOCHOSTUIFLAG_SCROLL_NO = 8;*/
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowUI(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ IOleInPlaceActiveObject *pActiveObject,
/* [in] */ IOleCommandTarget *pCommandTarget,
/* [in] */ IOleInPlaceFrame *pFrame,
/* [in] */ IOleInPlaceUIWindow *pDoc)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_HideUI(IDocHostUIHandler * This)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_UpdateUI(IDocHostUIHandler * This)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_EnableModeless(IDocHostUIHandler * This,
/* [in] */ BOOL fEnable)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnDocWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnFrameWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_ResizeBorder(IDocHostUIHandler * This,
/* [in] */ LPCRECT prcBorder,
/* [in] */ IOleInPlaceUIWindow *pUIWindow,
/* [in] */ BOOL fRameWindow)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateAccelerator(IDocHostUIHandler * This,
/* [in] */ LPMSG lpMsg,
/* [in] */ const GUID *pguidCmdGroup,
/* [in] */ DWORD nCmdID)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetOptionKeyPath(IDocHostUIHandler * This,
/* [out] */ LPOLESTR *pchKey,
/* [in] */ DWORD dw)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetDropTarget(IDocHostUIHandler * This,
/* [in] */ IDropTarget *pDropTarget,
/* [out] */ IDropTarget **ppDropTarget)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetExternal(IDocHostUIHandler * This,
/* [out] */ IDispatch **ppDispatch)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateUrl(IDocHostUIHandler * This,
/* [in] */ DWORD dwTranslate,
/* [in] */ OLECHAR *pchURLIn,
/* [out] */ OLECHAR **ppchURLOut)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_FilterDataObject(IDocHostUIHandler * This,
/* [in] */ IDataObject *pDO,
/* [out] */ IDataObject **ppDORet)
{
NOTIMPLEMENTED;
}
目前的问题是 QueryInterface如何写.
这个接口的函数GetHostInfo是自己写的程序调用,还是IE调用.如何是自己写的程序调用,在什么情 况下调用.
HRESULT STDMETHODCALLTYPE DocHostUI_QueryInterface(IDocHostUIHandler * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject)
{
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_AddRef(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_Release(IDocHostUIHandler * This)
{
return(1);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowContextMenu(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ POINT *ppt,
/* [in] */ IUnknown *pcmdtReserved,
/* [in] */ IDispatch *pdispReserved)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetHostInfo(IDocHostUIHandler * This,
/* [out][in] */ DOCHOSTUIINFO *pInfo)
{
//去掉3D边框
pInfo->dwFlags |= DOCHOSTUIFLAG_NO3DBORDER;/*DOCHOSTUIFLAG_NO3DBORDER = 4; */
//去掉滚动条
pInfo->dwFlags |= DOCHOSTUIFLAG_SCROLL_NO;/*DOCHOSTUIFLAG_SCROLL_NO = 8;*/
return(S_OK);
}
HRESULT STDMETHODCALLTYPE DocHostUI_ShowUI(IDocHostUIHandler * This,
/* [in] */ DWORD dwID,
/* [in] */ IOleInPlaceActiveObject *pActiveObject,
/* [in] */ IOleCommandTarget *pCommandTarget,
/* [in] */ IOleInPlaceFrame *pFrame,
/* [in] */ IOleInPlaceUIWindow *pDoc)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_HideUI(IDocHostUIHandler * This)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_UpdateUI(IDocHostUIHandler * This)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_EnableModeless(IDocHostUIHandler * This,
/* [in] */ BOOL fEnable)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnDocWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_OnFrameWindowActivate(IDocHostUIHandler * This,
/* [in] */ BOOL fActivate)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_ResizeBorder(IDocHostUIHandler * This,
/* [in] */ LPCRECT prcBorder,
/* [in] */ IOleInPlaceUIWindow *pUIWindow,
/* [in] */ BOOL fRameWindow)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateAccelerator(IDocHostUIHandler * This,
/* [in] */ LPMSG lpMsg,
/* [in] */ const GUID *pguidCmdGroup,
/* [in] */ DWORD nCmdID)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetOptionKeyPath(IDocHostUIHandler * This,
/* [out] */ LPOLESTR *pchKey,
/* [in] */ DWORD dw)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetDropTarget(IDocHostUIHandler * This,
/* [in] */ IDropTarget *pDropTarget,
/* [out] */ IDropTarget **ppDropTarget)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_GetExternal(IDocHostUIHandler * This,
/* [out] */ IDispatch **ppDispatch)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_TranslateUrl(IDocHostUIHandler * This,
/* [in] */ DWORD dwTranslate,
/* [in] */ OLECHAR *pchURLIn,
/* [out] */ OLECHAR **ppchURLOut)
{
NOTIMPLEMENTED;
}
HRESULT STDMETHODCALLTYPE DocHostUI_FilterDataObject(IDocHostUIHandler * This,
/* [in] */ IDataObject *pDO,
/* [out] */ IDataObject **ppDORet)
{
NOTIMPLEMENTED;
}
目前的问题是 QueryInterface如何写.
这个接口的函数GetHostInfo是自己写的程序调用,还是IE调用.如何是自己写的程序调用,在什么情 况下调用.