用execwb会出现那个对话框。 procedure TForm1.Button1Click(Sender: TObject); var HTMLDocument: IHTMLDocument2; PersistFile: IPersistFile; begin HTMLDocument := webbrowser1.Document as IHTMLDocument2; while HTMLDocument.readyState <> 'complete' do Application.ProcessMessages; PersistFile := HTMLDocument as IPersistFile; PersistFile.Save(StringToOleStr(htmlfilename), system.True);end;
我给你一个示例,你看看是否就是你想要的? 请给出你的E-Mail我给你邮来。
自己写代码就可以实现啦,不过很麻烦,比调用TWebBrowser的那个弹出保存对话框要麻烦的多
to: qiubolecn(来自差生市) 程序里要用些什么样的unit? 我在帮助里没有找到
这样是不是会保存所有的图片? 就像execwb保存的操作那样,建立一个目录来保存图片?
to: jasper_liu (波仔) 真是对不起,我的代码现在怎么也找不到了,实在不好意思。 不过它也只能保存为HTML文档,请多原谅呵!
jasper_liu(波仔) :不好意思,最近功课忙!我提供给你一个函数:IE自带的!URLDownloadToFile它的VB声明是:Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long使用方法 URLDownloadToFile(0, szURL, szFileName, 0, 0)
procedure TForm1.Button1Click(Sender: TObject);
var
HTMLDocument: IHTMLDocument2;
PersistFile: IPersistFile;
begin
HTMLDocument := webbrowser1.Document as IHTMLDocument2; while HTMLDocument.readyState <> 'complete' do
Application.ProcessMessages; PersistFile := HTMLDocument as IPersistFile;
PersistFile.Save(StringToOleStr(htmlfilename), system.True);end;
请给出你的E-Mail我给你邮来。
程序里要用些什么样的unit?
我在帮助里没有找到
就像execwb保存的操作那样,建立一个目录来保存图片?
真是对不起,我的代码现在怎么也找不到了,实在不好意思。
不过它也只能保存为HTML文档,请多原谅呵!
qiubolecn(来自差生市)
lixif()