He hecho un par de cambios en el link que publica Julián y me funciona correctamente:
Código Delphi
[-]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,Wininet;
function LeerUnTrozoDeDocumentoHtmDesdeInternet( sUrl: string): string;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
function LeerUnTrozoDeDocumentoHtmDesdeInternet( sUrl: string): string;
type
tbuffer = array[0..100] of char; puedes poner mas grande el buffer
pbuffer = ^TBuffer;
var
buffer : pBuffer;
a : cardinal;
ihConnect,
ihSession,
iDocument : HINTERNET;
begin
Result:='NadaDeNada'; ihConnect:=InternetOpen('dChat/2.0 (JulianWEB)', LOCAL_INTERNET_ACCESS, '', '', 0);
iDocument:=InternetOpenURL(ihConnect, pChar(sUrl), NIL, 1,
INTERNET_FLAG_RELOAD or INTERNET_FLAG_DONT_CACHE or INTERNET_FLAG_RAW_DATA, 0);
if iDocument<>nil then try
New(buffer);
InternetReadFile(iDocument, Buffer, sizeof(TBuffer), a);
Result:=pchar(buffer);
finally
internetCloseHandle(iDocument);
Dispose(buffer);
InternetCloseHandle(ihConnect);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.text:=LeerUnTrozoDeDocumentoHtmDesdeInternet('http://www.clubdelphi.com');
end;
end.
Un Saludo.