var
h_cachedInternet: HINTERNET;
function GetRawHtml(
var web_browser: TWebBrowser):
String;
var
http_handle: HINTERNET;
buffer:
array [0..20]
of Char;
url:
String;
bytes_read: DWORD;
begin
url := web_browser.LocationURL;
http_handle := InternetOpenUrl(h_cachedInternet,
PChar(
url),
nil,0,INTERNET_FLAG_NO_UI,0);
if http_handle =
nil then
result := '
'
else
begin
//--------------------------------------------------------------
// Retrieve the URL data. Hopefully this should be straight from
// the cache because of how the internet connection was defined.
//--------------------------------------------------------------
result := '
';
repeat
InternetReadFile(http_handle,@buffer,Length(buffer),bytes_read);
result := result + Copy(buffer,1,bytes_read);
until bytes_read =0;
InternetCloseHandle(http_handle);
end;
end;
initialization
//--------------------
// Initialise WinInet.
//--------------------
h_cachedInternet := InternetOpen(PChar(application.title),
INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY,
nil,
nil,
INTERNET_FLAG_FROM_CACHE);