delphi 自动滚动到最底端scroll


自动滚动到最底端scroll

Uses MSHTML;
{$R *.dfm}
var
  ScrollPos: integer=0;
procedure TForm1.Button1Click(Sender: TObject);
begin
  inc(ScrollPos, 10);
  if WebBrowser1.Document <> nil then
    (WebBrowser1.Document as IHTMLDocument2).parentWindow.scroll(0,ScrollPos);
end;
 
 
 
 
 
// *********************************************************************//
// Interface: IHTMLWindow2
// Flags:     (4416) Dual OleAutomation Dispatchable
// GUID:      {332C4427-26CB-11D0-B483-00C04FD90119}
// *********************************************************************//
  IHTMLWindow2 = interface(IHTMLFramesCollection2)
    ['{332C4427-26CB-11D0-B483-00C04FD90119}']
    function Get_frames: IHTMLFramesCollection2; safecall;
    procedure Set_defaultStatus(const p: WideString); safecall;
    function Get_defaultStatus: WideString; safecall;
    procedure Set_status(const p: WideString); safecall;
    function Get_status: WideString; safecall;
    function setTimeout(const expression: WideString; msec: Integer; var language: OleVariant): Integer; safecall;
    procedure clearTimeout(timerID: Integer); safecall;
    procedure alert(const message: WideString); safecall;
    function confirm(const message: WideString): WordBool; safecall;
    function prompt(const message: WideString; const defstr: WideString): OleVariant; safecall;
    function Get_Image: IHTMLImageElementFactory; safecall;
    function Get_location: IHTMLLocation; safecall;
    function Get_history: IOmHistory; safecall;
    procedure close; safecall;
    procedure Set_opener(p: OleVariant); safecall;
    function Get_opener: OleVariant; safecall;
    function Get_navigator: IOmNavigator; safecall;
    procedure Set_name(const p: WideString); safecall;
    function Get_name: WideString; safecall;
    function Get_parent: IHTMLWindow2; safecall;
    function open(const url: WideString; const name: WideString; const features: WideString; 
                  replace: WordBool): IHTMLWindow2; safecall;
    function Get_self: IHTMLWindow2; safecall;
    function Get_top: IHTMLWindow2; safecall;
    function Get_window: IHTMLWindow2; safecall;
    procedure navigate(const url: WideString); safecall;
    procedure Set_onfocus(p: OleVariant); safecall;
    function Get_onfocus: OleVariant; safecall;
    procedure Set_onblur(p: OleVariant); safecall;
    function Get_onblur: OleVariant; safecall;
    procedure Set_onload(p: OleVariant); safecall;
    function Get_onload: OleVariant; safecall;
    procedure Set_onbeforeunload(p: OleVariant); safecall;
    function Get_onbeforeunload: OleVariant; safecall;
    procedure Set_onunload(p: OleVariant); safecall;
    function Get_onunload: OleVariant; safecall;
    procedure Set_onhelp(p: OleVariant); safecall;
    function Get_onhelp: OleVariant; safecall;
    procedure Set_onerror(p: OleVariant); safecall;
    function Get_onerror: OleVariant; safecall;
    procedure Set_onresize(p: OleVariant); safecall;
    function Get_onresize: OleVariant; safecall;
    procedure Set_onscroll(p: OleVariant); safecall;
    function Get_onscroll: OleVariant; safecall;
    function Get_document: IHTMLDocument2; safecall;
    function Get_event: IHTMLEventObj; safecall;
    function Get__newEnum: IUnknown; safecall;
    function showModalDialog(const dialog: WideString; var varArgIn: OleVariant; 
                             var varOptions: OleVariant): OleVariant; safecall;
    procedure showHelp(const helpURL: WideString; helpArg: OleVariant; const features: WideString); safecall;
    function Get_screen: IHTMLScreen; safecall;
    function Get_Option: IHTMLOptionElementFactory; safecall;
    procedure focus; safecall;
    function Get_closed: WordBool; safecall;
    procedure blur; safecall;
    procedure scroll(x: Integer; y: Integer); safecall;
    function Get_clientInformation: IOmNavigator; safecall;
    function setInterval(const expression: WideString; msec: Integer; var language: OleVariant): Integer; safecall;
    procedure clearInterval(timerID: Integer); safecall;
    procedure Set_offscreenBuffering(p: OleVariant); safecall;
    function Get_offscreenBuffering: OleVariant; safecall;
    function execScript(const code: WideString; const language: WideString): OleVariant; safecall;
    function toString: WideString; safecall;
    procedure scrollBy(x: Integer; y: Integer); safecall;
    procedure scrollTo(x: Integer; y: Integer); safecall;
    procedure moveTo(x: Integer; y: Integer); safecall;
    procedure moveBy(x: Integer; y: Integer); safecall;
    procedure resizeTo(x: Integer; y: Integer); safecall;
    procedure resizeBy(x: Integer; y: Integer); safecall;
    function Get_external: IDispatch; safecall;
    property frames: IHTMLFramesCollection2 read Get_frames;
    property defaultStatus: WideString read Get_defaultStatus write Set_defaultStatus;
    property status: WideString read Get_status write Set_status;
    property Image: IHTMLImageElementFactory read Get_Image;
    property location: IHTMLLocation read Get_location;
    property history: IOmHistory read Get_history;
    property opener: OleVariant read Get_opener write Set_opener;
    property navigator: IOmNavigator read Get_navigator;
    property name: WideString read Get_name write Set_name;
    property parent: IHTMLWindow2 read Get_parent;
    property self: IHTMLWindow2 read Get_self;
    property top: IHTMLWindow2 read Get_top;
    property window: IHTMLWindow2 read Get_window;
    property onfocus: OleVariant read Get_onfocus write Set_onfocus;
    property onblur: OleVariant read Get_onblur write Set_onblur;
    property onload: OleVariant read Get_onload write Set_onload;
    property onbeforeunload: OleVariant read Get_onbeforeunload write Set_onbeforeunload;
    property onunload: OleVariant read Get_onunload write Set_onunload;
    property onhelp: OleVariant read Get_onhelp write Set_onhelp;
    property onerror: OleVariant read Get_onerror write Set_onerror;
    property onresize: OleVariant read Get_onresize write Set_onresize;
    property onscroll: OleVariant read Get_onscroll write Set_onscroll;
    property document: IHTMLDocument2 read Get_document;
    property event: IHTMLEventObj read Get_event;
    property _newEnum: IUnknown read Get__newEnum;
    property screen: IHTMLScreen read Get_screen;
    property Option: IHTMLOptionElementFactory read Get_Option;
    property closed: WordBool read Get_closed;
    property clientInformation: IOmNavigator read Get_clientInformation;
    property offscreenBuffering: OleVariant read Get_offscreenBuffering write Set_offscreenBuffering;
    property external: IDispatch read Get_external;
  end;




原文地址:https://www.cnblogs.com/xe2011/p/3876341.html