如何用pb实现保存网页原代码

loosong 2002-11-21 09:01:51
急!急!各位大虾,请问在pb中,如果知道一个网址如http://……,我想把它所指向的网页(或它的原代码,以文本形式)保存到本地硬盘上,应该如何实现呢,多谢赐教,不胜感激!!
...全文
24 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jzhaohua 2002-11-22
  • 打赏
  • 举报
回复
关注
jimly 2002-11-21
  • 打赏
  • 举报
回复
用API函数URLDownloadToFile,pb中没用过

URLDownloadToFile Function

--------------------------------------------------------------------------------

Downloads bits from the Internet and saves them to a file.

Syntax

HRESULT URLDownloadToFile( LPUNKNOWN pCaller,
LPCTSTR szURL,
LPCTSTR szFileName,
DWORD dwReserved,
LPBINDSTATUSCALLBACK lpfnCB
);
Parameters

pCaller
Pointer to the controlling IUnknown interface of the calling Microsoft® ActiveX® component (if the caller is an ActiveX component). If the calling application is not an ActiveX component, this value can be set to NULL. Otherwise, the caller is a Component Object Model (COM) object that is contained in another component (such as an ActiveX control within the context of an HTML page). This parameter represents the outermost IUnknown of the calling component. The function attempts the download within the context of the ActiveX client framework and allows the caller's container to receive callbacks on the progress of the download.
szURL
Pointer to a string value containing the URL to be downloaded. Cannot be set to NULL.
szFileName
Pointer to a string value containing the name of the file to create for bits that come from the download.
dwReserved
Reserved. Must be set to 0.
lpfnCB
Pointer to the caller's IBindStatusCallback interface. URLDownloadToFile calls this interface's IBindStatusCallback::OnProgress method on a connection activity, including the arrival of data. IBindStatusCallback::OnDataAvailable is never called. Implementing IBindStatusCallback::OnProgress allows a caller to implement a user interface or other progress monitoring functionality. It also allows the download operation to be canceled by returning E_ABORT from the IBindStatusCallback::OnProgress call. This can be set to NULL.
Return Value

Returns one of the following values.

E_OUTOFMEMORY The buffer length is invalid or there was insufficient memory to complete the operation.
S_OK The operation succeeded.


Remarks

The client can choose to be notified of progress through a notification callback.

Function Information

Header Urlmon.h
Import library Urlmon.lib
Minimum availability Internet Explorer 3.0
Minimum operating systems Windows NT 4.0, Windows 95

740

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 脚本语言
社区管理员
  • 脚本语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧