| 保存webbrowser中的HTML内容 
 利用IPersist接口可以实现保存HTML到文件,在VB和Delphi下的实现是这样的: 
VB: 
  Dim oPF As IPersistFile  Set oPF = WebBrowser1.Document  oPF.Save "TheFileNameHere.htm", False 
 
  Delphi: 
  uses    MSHTML,OleCtrls, SHDocVw, StdCtrls,ActiveX;  function GetHTMLCode(WB: IWebbrowser2; ACode: TStrings): Boolean;  var    ps: IPersistStreamInit;    s: string;    ss: TStringStream;    sa: IStream;  begin    ps := WB.document as IPersistStreamInit;    s := '';    ss := TStringStream.Create(s);    try      sa:= TStreamAdapter.Create(ss, soReference) as IStream;      Result := Succeeded(ps.Save(sa, Bool(True)));      if Result then ACode.Add(ss.Datastring);    finally      ss.Free;    end;  end; 
 
  至于VC下的实现方法,可以参考蒋晟的这篇文章:  http://www.csdn.net/develop/read_article.asp?id=18465  
另外VB地实现需要引用ole_lib,这个引用在 http://www.mvps.org/emorcillo/vb6/tlb/tl_ole.zip下载  
 
  |