国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

保存頁面為MHT的代碼

2019-11-18 18:04:27
字體:
來源:轉載
供稿:網友
 

Here's how to save a web page as a single file (mht format) using Delphi code:

uses CDO_TLB, ADODB_TLB;...PRocedure WB_SaveAs_MHT(WB: TWebBrowser; FileName: TFileName);var  Msg: IMessage;  Conf: IConfiguration;  Stream: _Stream;  URL : widestring;begin  if not Assigned(WB.Document) then Exit;  URL := WB.LocationURL;  Msg := CoMessage.Create;  Conf := CoConfiguration.Create;  try    Msg.Configuration := Conf;    Msg.CreateMHTMLBody(URL, cdoSuppressAll, '', '');    Stream := Msg.GetStream;    Stream.SaveToFile(FileName, adSaveCreateOverWrite);  finally    Msg := nil;    Conf := nil;    Stream := nil;  end;end; (* WB_SaveAs_MHT *)

Sample usage:

  //first navigate  WebBrowser1.Navigate('http://delphi.about.com');    //then save  WB_SaveAs_MHT(WebBrowser1,'c:/WebBrowser1.mht');

Note 1: The _Stream class is defined in ADODB_TLB unit that you probably already have created. The IMessage and IConfiguration interfaces code from cdosys.dll library. CDO stands for Collaboration Data Objects - object libraries designed to enable SMTP Messaging.
The CDO_TLB is an auto generated unit by Delphi. To create it, from the main menu select "Import Type Library", select "C:/WINDOWS/system32/cdosys.dll" then click the "Create unit" button.


上一篇:進程查看器1.2版,歡迎下載

下一篇:通過api和鍵盤鉤子徹底屏蔽任務條和開始菜單

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
學習交流
熱門圖片

新聞熱點

疑難解答

圖片精選

網友關注

主站蜘蛛池模板: 集安市| 十堰市| 科技| 乐至县| 罗定市| 大荔县| 肃北| 大城县| 常山县| 南陵县| 高阳县| 托里县| 云安县| 盐亭县| 东丽区| 周口市| 武山县| 遂昌县| 株洲县| 博白县| 红河县| 罗定市| 友谊县| 金乡县| 沙洋县| 班玛县| 绿春县| 枣庄市| 农安县| 商都县| 商洛市| 汉川市| 天峻县| 台北县| 长乐市| 昌宁县| 昭通市| 菏泽市| 甘谷县| 宝兴县| 彭州市|