Einzelnen Beitrag anzeigen

Benutzerbild von Mavarik
Mavarik

Registriert seit: 9. Feb 2006
Ort: Stolberg (Rhld)
4.143 Beiträge
 
Delphi 10.3 Rio
 
#9

Re: TWebBrowser Sourcecode auslesen

  Alt 4. Apr 2006, 20:28
Versuch doch mal:

Delphi-Quellcode:
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);
Frank

Zu finden bei Brian Cryer
  Mit Zitat antworten Zitat