Einzelnen Beitrag anzeigen

Zwixx

Registriert seit: 2. Nov 2006
37 Beiträge
 
Delphi 10.3 Rio
 
#1

"Feature not implemented" bei der Analyse via MSHTML unter Win7

  Alt 28. Jan 2014, 10:38
Ich verwende folgenden Code um die Tags eines TWebBrowsers zu ermitteln:

Delphi-Quellcode:
var
  Document: IHTMLDocument2;
  Tags: IHTMLElementCollection;
  Tag: IHTMLElement;
  Body: IHTMLElement2;
  a : IHTMLElementCollection;
  b : IInterface;
begin
  // Switch off scrollbars
  WebBrowser1.OleObject.document.body.style.overflowX := 'hidden';
  WebBrowser1.OleObject.document.body.style.overflowY := 'hidden';

  // Switch off borders
  WebBrowser1.OleObject.document.body.style.borderstyle := 'none';

  // Check for valid document: require IHTMLDocument2 interface to it
  if not Supports(WebBrowser1.OleObject.document, IHTMLDocument2, Document) then
    raise Exception.Create('Invalid HTML document');
  // Check for valid body element: require IHTMLElement2 interface to it
  a := IHTMLElementCollection(Document.all.tags('head'));
  b := a.item(null, 0);
  if not Supports(b, IHTMLElement2, Body) then
    raise Exception.Create('Can''t find <body> element');

  Tags := Body.getElementsByTagName('meta');

  // Scan through all tags in body
  for I := 0 to Pred(Tags.length) do
  begin
    Tag := Tags.item(I, EmptyParam) as IHTMLElement;
    if AnsiSameText(Tag.getAttribute('name', 0), 'zzz') then
...
Dieses Verfahren funktioniert unter Windows XP mit dem IE 8 sehr gut. Unter Windows 7 mit dem IE 9 allerdings kommt es in der Zeile " b := a.item(null, 0);" zu einer EOleException mit der Meldung "Nicht implementiert". Gibt es da eine einfache Lösung dies zu umgehen? Möglichst so, das es auf beiden System klappt?

Geändert von Zwixx (28. Jan 2014 um 10:43 Uhr)
  Mit Zitat antworten Zitat