那位大哥帮帮小弟<br><br><br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls,wininet;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br>function GetWebPage(const Url: string):string;<br>var<br> Session,<br> HttpFile:HINTERNET;<br> szSizeBuffer
ointer;<br> dwLengthSizeBuffer
Word;<br> dwReserved
Word;<br> dwFileSize
Word;<br> dwBytesRead
Word;<br> Contents
Char;<br>begin<br> Session:=InternetOpen('',0,niL,niL,0);<br> HttpFile:=InternetOpenUrl(Session,PChar(Url),niL,0,0,0);<br> dwLengthSizeBuffer:=1024;<br> HttpQueryInfo(HttpFile,5,szSizeBuffer,dwLengthSizeBuffer,dwReserved);<br> GetMem(Contents,dwFileSize);<br> InternetReadFile(HttpFile,Contents,dwFileSize,dwBytesRead);<br> InternetCloseHandle(HttpFile);<br> InternetCloseHandle(Session);<br> Result:=StrPas(Contents);<br> FreeMem(Contents);<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> showmessage(GetWebPage('http://www.aaccaa.com'));<br>end;<br><br>end.