首页 > 代码库 > delphi 保存网页

delphi 保存网页

保存网页. html

uses ActiveX;


procedure TForm1.Button1Click(Sender: TObject);
var
  persist :IPersistfile;
begin
  persist := (webbrowser1.document as ipersistfile);
  persist.save(‘c:\a.html‘,false);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  WebBrowser1.Navigate(‘abc.com‘);
end;












 IPersistFile = interface(IPersist)
    [‘{0000010B-0000-0000-C000-000000000046}‘]
    function IsDirty: HResult; stdcall;
    function Load(pszFileName: POleStr; dwMode: Longint): HResult;
      stdcall;
    function Save(pszFileName: POleStr; fRemember: BOOL): HResult;
      stdcall;
    function SaveCompleted(pszFileName: POleStr): HResult;
      stdcall;
    function GetCurFile(out pszFileName: POleStr): HResult;
      stdcall;
  end;
  {$EXTERNALSYM IPersistFile}
  {$HPPEMIT ‘DECLARE_DINTERFACE_TYPE(IPersistFile)‘}


来自为知笔记(Wiz)


附件列表