HTML 긁어오는 프로그램 소스 | |||
| |||
Another approach, if you have Delphi 6, is to use the TDownloadURL object. The TDownloadURL object, defined in ExtActns.pas unit, is designed for saving the contents of a specified URL to a file. Here's the code that uses the TDownloadURL to download the "What's New and Hot" page from this site. uses extactns; // <- must be added // function Download_HTM(const sURL, sLocalFileName:string): boolean; begin Result:=True; with TDownLoadURL.Create(nil) do try URL:=sURL; Filename:=sLocalFileName; try ExecuteTarget(nil); except Result:=False end; finally Free; end; end; This function, Download_HTM, downloads a file from the URL specified in the sURL parameter, and saves this file locally under a sLocalFileName name. The function returns True if it succeeds, False otherwise. Of course, this function is to be called from the Button1 OnClick event handler. You can see the code below. Note that, locally, the file is saved as c: emp_adp.newandhot. procedure TForm1.Button1Click(Sender: TObject); const ADPNEWHOTURL='http://delphi.about.com/cs/newandhot/index.htm'; TmpFileName='c: emp_adp.newandhot'; begin if NOT Download_HTM(ADPNEWHOTURL,TmpFileName) then begin ShowMessage('Error in HTML file download'); Exit; end; { more code to be added } end; Note: In the process of downloading a file, the TDownloadURL periodically generates an OnDownloadProgress event, so that you can provide users with feedback about the process. I'll leave this for you to implement. Tags: capture grab 스크랩 윈도우즈 | |||
| |||
| |||
로그인을 하시면 댓글을 등록 할 수 있습니다. |
OTHER POSTS IN THE SAME CATEGORY wave 파일 mixing 하기. (웨이브 믹싱) |