干吗老控件控件的,学学用API和COM。
如果是http,用Wininet的API或者IXMLHTTPRequest都可以
给你个例子,那http://www.163.com
function Get163: string;
var
s: string = '*/*';
buf: char[0..4095] of char;
n: dword;
hSession, hConn, hRequest: THandle;
begin
hSession = InternetOpen(nil,INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
hConn = InternetConnect(hSession, 'www.163.com', 80, nil, nil, INTERNET_SERVICE_HTTP, 0,0);
hRequest = HttpOpenRequest(hconn,'GET', '/', 'HTTP/1.1', nil, @s[1], INTERNET_FLAG_RELOAD or INTERNET_FLAG_NO_CACHE_WRITE);
result := '';
if HttpSendRequest(hRequest, nil, 0, nil, 0) then
repeat
if not InternetReadFile(hRequest, buf, sizeof(buf), n) then
begin
//something wrong, handle here.
end;
if n = 0 then break; //全部读完了
//处理buf里的数据
setstring(s, buf, n);
result := result + s;
until false;
CloseHandle(hRequest);
CloseHandle(hConn);
CloseHandle(hSession);
end;
或者用IXMLHttpRequest, 这样做
uses msxml;
function get163: string;
var
http: IXMLHttpRequest;
begin
http := coXMLHttp.create;
http.open('GET', 'http://www.163.com', false, nil, nil);
http.send(varEmpty);
result := http.responsetext;
end;