AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein "Feature not implemented" bei der Analyse via MSHTML unter Win7

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

Ein Thema von Zwixx · begonnen am 28. Jan 2014 · letzter Beitrag vom 29. Jan 2014
Antwort Antwort
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
Der schöne Günther

Registriert seit: 6. Mär 2013
6.108 Beiträge
 
Delphi 10 Seattle Enterprise
 
#2

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

  Alt 28. Jan 2014, 11:28
Ich kenne mich mit dem Thema nicht aus, aber nach der Doku zu IHTMLElementCollection::item sehe ich keinen Sinn, als ersten Parameter nil zu verwenden:
Zitat:
[in] VARIANT of type VT_I4 or VT_BSTR that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.
Mal mit 0 versucht?
  Mit Zitat antworten Zitat
Zwixx

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

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

  Alt 28. Jan 2014, 13:48
Ja, leider mit dem gleichen Ergebnis.
  Mit Zitat antworten Zitat
Thom

Registriert seit: 19. Mai 2006
570 Beiträge
 
Delphi XE3 Professional
 
#4

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

  Alt 28. Jan 2014, 15:00
Delphi-Quellcode:
  a := IHTMLElementCollection(Document.all.tags('head'));
  [...]
Die Funktion tags liefert ein IDispatch- und kein IHTMLElementCollection-Interface. Deshalb geht ein harter Cast an dieser Stelle schief und der Versuch, die Funktion item aufzurufen, wird mit der korrekten Fehlermeldung quittiert, da IDispatch tatsächlich keine Funktion item unterstützt.
Besser wäre:
Delphi-Quellcode:
var
  i: IDispatch;
  [...]
begin
  [...]
  i := Document.all.tags('head');
  if not Supports(i, IHTMLElementCollection, a) then
    raise Exception.Create('Keine HTMLElementCollection');
  b := a.item(null, 0);
  [...]
end;
Thomas Nitzschke
Google Maps mit Delphi
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.097 Beiträge
 
Delphi 12 Athens
 
#5

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

  Alt 28. Jan 2014, 15:22
a := Document.all.tags('head') as IHTMLElementCollection;
Ging inzwischen das AS nicht auch bei Interfaces? (in "neueren" Delphis)
(Da würde dann der Compiler das Supports intern versteckt aufrufen)
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests

Geändert von himitsu (28. Jan 2014 um 17:14 Uhr)
  Mit Zitat antworten Zitat
Thom

Registriert seit: 19. Mai 2006
570 Beiträge
 
Delphi XE3 Professional
 
#6

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

  Alt 28. Jan 2014, 17:11
Ja, das würde hier auch gehen - mit der kleinen Einschränkung, daß dann nicht mehr ausgewählt werden kann, welche Exception im Fehlerfall erzeugt wird.
Thomas Nitzschke
Google Maps mit Delphi
  Mit Zitat antworten Zitat
Zwixx

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

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

  Alt 29. Jan 2014, 08:08
Hat funktioniert, vielen Dank
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:14 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz