紧急:IDocHostUIHandle在哪个单元声明的?有用过的朋友请出手~~~ ( 积分: 20 )

  • 主题发起人 主题发起人 net_morning
  • 开始时间 开始时间
N

net_morning

Unregistered / Unconfirmed
GUEST, unregistred user!
需要引用哪个单元才能使用,谢谢!!!
 
MSDN的帮助

IDocHostUIHandler Interface

--------------------------------------------------------------------------------

This custom interface enables an application hosting the WebBrowser Control or automating Microsoft Internet Explorer to replace the menus, toolbars, and context menus used by MSHTML.

IDocHostUIHandler Members

EnableModeless Called by the MSHTML implementation of IOleInPlaceActiveObject::EnableModeless. Also called when MSHTML displays a modal UI.
FilterDataObject Called by MSHTML to allow the host to replace the MSHTML data object.
GetDropTarget Called by MSHTML when it is used as a drop target. This method enables the host to supply an alternative IDropTarget interface.
GetExternal Called by MSHTML to obtain the host's IDispatch interface.
GetHostInfo Called by MSHTML to retrieve the user interface (UI) capabilities of the application that is hosting MSHTML.
GetOptionKeyPath Called by the WebBrowser Control to retrieve a registry subkey path that overrides the default Internet Explorer registry settings.
HideUI Called when MSHTML removes its menus and toolbars.
OnDocWindowActivate Called by the MSHTML implementation of IOleInPlaceActiveObject::OnDocWindowActivate.
OnFrameWindowActivate Called by the MSHTML implementation of IOleInPlaceActiveObject::OnFrameWindowActivate.
ResizeBorder Called by the MSHTML implementation of IOleInPlaceActiveObject::ResizeBorder.
ShowContextMenu Called by MSHTML to display a shortcut menu.
ShowUI Called by MSHTML to enable the host to replace MSHTML menus and toolbars.
TranslateAccelerator Called by MSHTML when IOleInPlaceActiveObject::TranslateAccelerator or IOleControlSite::TranslateAccelerator is called.
TranslateUrl Called by MSHTML to give the host an opportunity to modify the URL to be loaded.
UpdateUI Called by MSHTML to notify the host that the command state has changed.

Remarks

On initialization, MSHTML calls QueryInterface on the host's client site, requesting an IDocHostUIHandler interface. If available, MSHTML will call IDocHostUIHandler methods at appropriate times during the lifetime of the MSHTML component.

Implementing this interface enables MSHTML to communicate with the host about its user interface status. The host can use this interface to modify such internal user interface elements as menus, context menus, and toolbars.

The interface identifier (IID) for this interface is BD3F23C0-D43E-11CF-893B-00AA00BDCE1A.

Interface Information

Stock Implementation None
Custom Implementation Yes
Inherits from IUnknown
Header and IDL files mshtmhst.h, mshtmhst.idl
Minimum availability Internet Explorer 4.0
Minimum operating systems Windows 95, Windows NT 4.0, Windows CE 2.12


--------------------------------------------------------------------------------

© 2005 Microsoft Corporation. All rights reserved.
 
参考
http://www.delphibbs.com/delphibbs/dispq.asp?lid=598504

unit MYIDocHostUIHandler;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, OleCtrls, SHDocVw_TLB, ActiveX;

const
DOCHOSTUITYPE_BROWSE= 0;
DOCHOSTUITYPE_AUTHOR= 1;
DOCHOSTUIDBLCLK_DEFAULT= 0;
DOCHOSTUIDBLCLK_SHOWPROPERTIES= 1;
DOCHOSTUIDBLCLK_SHOWCODE= 2;
DOCHOSTUIFLAG_DIALOG = 1;
DOCHOSTUIFLAG_DISABLE_HELP_MENU = 2;
DOCHOSTUIFLAG_NO3DBORDER = 4;
DOCHOSTUIFLAG_SCROLL_NO = 8;
DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE = 16;
DOCHOSTUIFLAG_OPENNEWWIN = 32;
DOCHOSTUIFLAG_DISABLE_OFFSCREEN = 64;
DOCHOSTUIFLAG_FLAT_SCROLLBAR = 128;
DOCHOSTUIFLAG_DIV_BLOCKDEFAULT = 256;
DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY = 512;

type
PDOCHOSTUIINFO = ^TDOCHOSTUIINFO;
TDOCHOSTUIINFO = record
cbSize: ULONG;
dwFlags: DWORD;
dwDoubleClick: DWORD;
end;

IDocHostShowUI = interface(IUnknown)
['{c4d244b0-d43e-11cf-893b-00aa00bdce1a}']
function ShowMessage(hwnd: THandle;lpstrText: POLESTR;lpstrCaption: POLESTR;
dwType: longint;lpstrHelpFile: POLESTR;dwHelpContext: longint;
var plResult: LRESULT): HRESULT; stdcall;
function ShowHelp(hwnd: THandle; pszHelpFile: POLESTR; uCommand: integer;
dwData: longint; ptMouse: TPoint;
var pDispachObjectHit: IDispatch): HRESULT; stdcall;
end; // IDocHostShowUI


IDocHostUIHandler = interface(IUnknown)
['{bd3f23c0-d43e-11cf-893b-00aa00bdce1a}']
function ShowContextMenu(const dwID: DWORD; const ppt: PPOINT;
const pcmdtReserved: IUnknown; const pdispReserved: IDispatch): HRESULT;
stdcall;
function GetHostInfo(var pInfo: TDOCHOSTUIINFO): HRESULT; stdcall;
function ShowUI(const dwID: DWORD; const pActiveObject:
IOleInPlaceActiveObject;
const pCommandTarget: IOleCommandTarget; const pFrame: IOleInPlaceFrame;
const pDoc: IOleInPlaceUIWindow): HRESULT; stdcall;
function HideUI: HRESULT; stdcall;
function UpdateUI: HRESULT; stdcall;
function EnableModeless(const fEnable: BOOL): HRESULT; stdcall;
function OnDocWindowActivate(const fActivate: BOOL): HRESULT; stdcall;
function OnFrameWindowActivate(const fActivate: BOOL): HRESULT; stdcall;
function ResizeBorder(const prcBorder: PRECT;
const pUIWindow: IOleInPlaceUIWindow;
const fRameWindow: BOOL): HRESULT; stdcall;
function TranslateAccelerator(const lpMsg: PMSG; const pguidCmdGroup: PGUID;
const nCmdID: DWORD): HRESULT; stdcall;
function GetOptionKeyPath(var pchKey: POLESTR; const dw: DWORD): HRESULT;
stdcall;
function GetDropTarget(const pDropTarget: IDropTarget;
out ppDropTarget: IDropTarget): HRESULT; stdcall;
function GetExternal(out ppDispatch: IDispatch): HRESULT; stdcall;
function TranslateUrl(const dwTranslate: DWORD; const pchURLIn: POLESTR;
var ppchURLOut: POLESTR): HRESULT; stdcall;
function FilterDataObject(const pDO: IDataObject;
out ppDORet: IDataObject): HRESULT; stdcall;
end; // IDocHostUIHandler


TEmbeddedWB = class(TWebBrowser, IUnknown, IDocHostUIHandler, IDocHostShowUI)
private
FRefCount: Integer;
protected
//IUnknown
function QueryInterface(const IID: TGUID; out Obj): Integer; stdcall;
function _AddRef: Longint; virtual; stdcall;
function _Release: Longint; virtual; stdcall;
public
// IDOcHostUIHandler
function ShowContextMenu(const dwID: DWORD; const ppt: PPOINT;
const pcmdtReserved: IUnknown; const pdispReserved: IDispatch): HRESULT;
stdcall;
function GetHostInfo(var pInfo: TDOCHOSTUIINFO): HRESULT; stdcall;
function ShowUI(const dwID: DWORD; const pActiveObject:
IOleInPlaceActiveObject;
const pCommandTarget: IOleCommandTarget; const pFrame: IOleInPlaceFrame;
const pDoc: IOleInPlaceUIWindow): HRESULT; stdcall;
function HideUI: HRESULT; stdcall;
function UpdateUI: HRESULT; stdcall;
function EnableModeless(const fEnable: BOOL): HRESULT; stdcall;
function OnDocWindowActivate(const fActivate: BOOL): HRESULT; stdcall;
function OnFrameWindowActivate(const fActivate: BOOL): HRESULT; stdcall;
function ResizeBorder(const prcBorder: PRECT;
const pUIWindow: IOleInPlaceUIWindow;
const fRameWindow: BOOL): HRESULT; stdcall;
function TranslateAccelerator(const lpMsg: PMSG; const pguidCmdGroup: PGUID;
const nCmdID: DWORD): HRESULT; stdcall;
function GetOptionKeyPath(var pchKey: POLESTR; const dw: DWORD): HRESULT;
stdcall;
function GetDropTarget(const pDropTarget: IDropTarget;
out ppDropTarget: IDropTarget): HRESULT; stdcall;
function GetExternal(out ppDispatch: IDispatch): HRESULT; stdcall;
function TranslateUrl(const dwTranslate: DWORD; const pchURLIn: POLESTR;
var ppchURLOut: POLESTR): HRESULT; stdcall;
function FilterDataObject(const pDO: IDataObject;
out ppDORet: IDataObject): HRESULT; stdcall;
// IDocHostShowUI
function ShowMessage(hwnd: THandle;
lpstrText: POLESTR;lpstrCaption: POLESTR;dwType: longint;lpstrHelpFile:
POLESTR;
dwHelpContext: longint; var plResult: LRESULT): HRESULT; stdcall;
function ShowHelp(hwnd: THandle; pszHelpFile: POLESTR; uCommand: integer;
dwData: longint; ptMouse: TPoint;
var pDispachObjectHit: IDispatch): HRESULT; stdcall;
{ Public declarations }
published
{ Published declarations }
end;

procedure Register;

implementation


function TEmbeddedWB.ShowMessage(hwnd: THandle; lpstrText: POLESTR;
lpstrCaption: POLESTR; dwType: longint;lpstrHelpFile: POLESTR;
dwHelpContext: longint; var plResult: LRESULT): HRESULT;
begin
RESULT := E_NotImpl;
end;

function TEmbeddedWB.ShowHelp(hwnd: THandle; pszHelpFile: POLESTR;
uCommand: integer; dwData: longint; ptMouse: TPoint;
var pDispachObjectHit: IDispatch): HRESULT;
begin
Result := S_OK;
end;


function TEmbeddedWB.QueryInterface(const iid: TGUID; out obj): Integer;
begin
if GetInterface(IID, Obj) then Result := S_OK else Result := E_NOINTERFACE;
end;

function TEmbeddedWB._AddRef: Longint;
begin
Inc(FRefCount);
Result := FRefCount;
end;

function TEmbeddedWB._Release: Longint;
begin
Dec(FRefCount);
RESULT := FRefCount;
end;

function TEmbeddedWB.ShowContextMenu(const dwID: DWORD; const ppt: PPOINT;
const pcmdtReserved: IUnknown; const pdispReserved: IDispatch): HRESULT;
begin
RESULT := S_OK;
end;

function TEmbeddedWB.GetHostInfo(var pInfo: TDOCHOSTUIINFO): HRESULT;
begin
pinfo.dwFlags := DOCHOSTUIFLAG_NO3DBORDER + DOCHOSTUIFLAG_SCROLL_NO;
pinfo.dwdoubleclick:=0;
RESULT := S_OK;
end;

function TEmbeddedWB.ShowUI(const dwID: DWORD;
const pActiveObject: IOleInPlaceActiveObject;
const pCommandTarget: IOleCommandTarget; const pFrame: IOleInPlaceFrame;
const pDoc: IOleInPlaceUIWindow): HRESULT;
begin
RESULT := S_Ok;
end;

function TEmbeddedWB.HideUI: HRESULT;
begin
RESULT := S_Ok;
end;

function TEmbeddedWB.UpdateUI: HRESULT;
begin
RESULT := E_NotImpl;
end;

function TEmbeddedWB.EnableModeless(const fEnable: BOOL): HRESULT;
begin
RESULT := E_NotImpl;
end;

function TEmbeddedWB.OnDocWindowActivate(const fActivate: BOOL): HRESULT;
begin
RESULT := E_NotImpl;
end;

function TEmbeddedWB.OnFrameWindowActivate(const fActivate: BOOL): HRESULT;
begin
RESULT := E_NotImpl;
end;

function TEmbeddedWB.ResizeBorder(const prcBorder: PRECT;
const pUIWindow: IOleInPlaceUIWindow; const fRameWindow: BOOL): HRESULT;
begin
RESULT := E_NotImpl;
end;

function TEmbeddedWB.TranslateAccelerator(const lpMsg: PMSG;
const pguidCmdGroup: PGUID; const nCmdID: DWORD): HRESULT;
begin
RESULT := E_NotImpl;
end;

function TEmbeddedWB.GetOptionKeyPath(var pchKey: POLESTR; const dw: DWORD):
HRESULT;
begin
RESULT := E_NotImpl;
end;

function TEmbeddedWB.GetDropTarget(const pDropTarget: IDropTarget;
out ppDropTarget: IDropTarget): HRESULT;
begin
RESULT := E_NotImpl;
end;

function TEmbeddedWB.GetExternal(out ppDispatch: IDispatch): HRESULT;
begin
RESULT := E_NotImpl;
end;

function TEmbeddedWB.TranslateUrl(const dwTranslate: DWORD;
const pchURLIn: POLESTR; var ppchURLOut: POLESTR): HRESULT;
begin
RESULT := E_NotImpl;
end;

function TEmbeddedWB.FilterDataObject(const pDO: IDataObject;
out ppDORet: IDataObject): HRESULT;
begin
RESULT := E_NotImpl;
end;


procedure Register;
begin
RegisterComponents('ActiveX', [TEmbeddedWB]);
end;

end.
 
IDocHostUIHandler = interface(IUnknown)
['{bd3f23c0-d43e-11cf-893b-00aa00bdce1a}']
function ShowContextMenu(const dwID: DWORD; const ppt: PPOINT;
const pcmdtReserved: IUnknown; const pdispReserved: IDispatch): HRESULT;
stdcall;
function GetHostInfo(var pInfo: TDOCHOSTUIINFO): HRESULT; stdcall;
function ShowUI(const dwID: DWORD; const pActiveObject:
IOleInPlaceActiveObject;
const pCommandTarget: IOleCommandTarget; const pFrame: IOleInPlaceFrame;
const pDoc: IOleInPlaceUIWindow): HRESULT; stdcall;
function HideUI: HRESULT; stdcall;
function UpdateUI: HRESULT; stdcall;
function EnableModeless(const fEnable: BOOL): HRESULT; stdcall;
function OnDocWindowActivate(const fActivate: BOOL): HRESULT; stdcall;
function OnFrameWindowActivate(const fActivate: BOOL): HRESULT; stdcall;
function ResizeBorder(const prcBorder: PRECT;
const pUIWindow: IOleInPlaceUIWindow;
const fRameWindow: BOOL): HRESULT; stdcall;
function TranslateAccelerator(const lpMsg: PMSG; const pguidCmdGroup: PGUID;
const nCmdID: DWORD): HRESULT; stdcall;
function GetOptionKeyPath(var pchKey: POLESTR; const dw: DWORD): HRESULT;
stdcall;
function GetDropTarget(const pDropTarget: IDropTarget;
out ppDropTarget: IDropTarget): HRESULT; stdcall;
function GetExternal(out ppDispatch: IDispatch): HRESULT; stdcall;
function TranslateUrl(const dwTranslate: DWORD; const pchURLIn: POLESTR;
var ppchURLOut: POLESTR): HRESULT; stdcall;
function FilterDataObject(const pDO: IDataObject;
out ppDORet: IDataObject): HRESULT; stdcall;
end; // IDocHostUIHandler
 
多人接受答案了。
 

Similar threads

D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
744
DelphiTeacher的专栏
D
D
回复
0
查看
718
DelphiTeacher的专栏
D
后退
顶部