S swpihwd Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-23 #1 各位,请问如何实现在程序中自动下载所需要的内容到本地。
X xianjun Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-23 #2 看看我以前写的用线程下载DFW离线资料的一小段代码: procedure TDownThread.Execute; var Stream: TStream; begin Stream := TFileStream.Create('你要保存的文件名', fmCreate); try with TIdHTTP.Create(nil) do try OnStatus := HTTPStatus; OnWork := HTTPWork; OnWorkBegin := HTTPWorkBegin; OnWorkEnd := HTTPWorkEnd; Get('文件的URL,如:http://www.richdata.com/data/1-1-2002.zip', Stream); finally Free; end; finally Stream.Free; end; end; 执行完就下载完啦 够简单。 []
看看我以前写的用线程下载DFW离线资料的一小段代码: procedure TDownThread.Execute; var Stream: TStream; begin Stream := TFileStream.Create('你要保存的文件名', fmCreate); try with TIdHTTP.Create(nil) do try OnStatus := HTTPStatus; OnWork := HTTPWork; OnWorkBegin := HTTPWorkBegin; OnWorkEnd := HTTPWorkEnd; Get('文件的URL,如:http://www.richdata.com/data/1-1-2002.zip', Stream); finally Free; end; finally Stream.Free; end; end; 执行完就下载完啦 够简单。 []