|
Use OnGetHostInfo to disable/enable scrollbars, 3D-borders, flat
scrollbars and more. GetHostInfo is called when a new page is about
to be displayed, so you can toggle scrollbars, borders etc. at run-time.
In the following sample 3D-borders, horizontal and vertical scrollbars
are removed:
function
TForm1.EmbeddedWB1GetHostInfo(var pInfo: TDOCHOSTUIINFO):
HRESULT;
begin
With pInfo do
begin
cbSize:=SizeOf(pInfo);
dwFlags:= DOCHOSTUIFLAG_NO3DBORDER or
DOCHOSTUIFLAG_SCROLL_NO;
dwDoubleClick:=DOCHOSTUIDBLCLK_DEFAULT;
end;
Result:=S_OK;
end; |
Use the following values:
TDOCHOSTUIINFO =
record
cbSize: ULONG;
dwFlags: DWORD;
dwDoubleClick: DWORD;
end;
cbSize: always set this to SizeOf(pInfo)
dwDoubleClick: one of the following:
DOCHOSTUIDBLCLK_DEFAULT = 0;
DOCHOSTUIDBLCLK_SHOWPROPERTIES = 1;
DOCHOSTUIDBLCLK_SHOWCODE = 2;
dwFlags: one or more of the following:
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;
|
In the following sample the Scrollbar is replaced with a Delphi
ScrollBar1.
function
TForm1.EmbeddedWB1GetHostInfo(var pInfo: TDOCHOSTUIINFO): HRESULT;
begin
with pInfo do
begin
cbSize := SizeOf(pInfo);
dwFlags := DOCHOSTUIFLAG_SCROLL_NO; //Don't show default
scrollbars
dwDoubleClick := DOCHOSTUIDBLCLK_DEFAULT;
end;
Result:=S_OK;
end;
procedure TForm1.EmbeddedWB1DocumentComplete(Sender:
TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
//Find the length of the document
Scrollbar1.Max := IHtmldocument2(Embeddedwb1.Document).Body.getAttribute('ScrollHeight',
0);
end;
procedure TForm1.ScrollBar1Scroll(Sender: TObject;
ScrollCode: TScrollCode;
var ScrollPos: Integer);
begin
// Scroll the document
if EmbeddedWB1.Document <> nil then
IHTMLWindow2(IHTMLDocument2(EmbeddedWB1.Document).ParentWindow).Scroll(0,
ScrollPos); |
|