Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Wert von OleVariant überprüfen? (https://www.delphipraxis.net/32459-wert-von-olevariant-ueberpruefen.html)

BorlanDelphiUser 25. Feb 2005 17:35

Re: Wert von OleVariant überprüfen?
 
@shmia ... also ich weis nicht mehr weiter es kommt immernoch die Exception. hast du das ganze mal selber getestet? Wär schon wenn du mal ein funktionierendes Beispiel zum download hier Anhängen könntest.

toms 25. Feb 2005 17:42

Re: Wert von OleVariant überprüfen?
 
Ich wuerd's etwa so machen:

Delphi-Quellcode:
procedure TForm1.Button3Click(Sender: TObject);
var
   x, Document : OleVariant; // nicht Variant
   Doc : IHTMLDocument2;
begin
  Assert(Assigned(WebBrowser.Document));
  if WebBrowser.Document.QueryInterface(IHTMLDocument2, Doc) = S_OK then
  begin
    x:= Doc.getElementById('countdown');
    if Assigned(x) then
       ShowMessage(x.innerHTML)
    else
      ShowMessage('countdown nicht gefunden :-(');
  end;
end;

BorlanDelphiUser 25. Feb 2005 17:48

Re: Wert von OleVariant überprüfen?
 
@toms
da gibts auch schon wieder Probleme :wall:

Zitat:

[Error] Unit1.pas(60): Undeclared identifier: 'getElementById'
[Error] Unit1.pas(61): Incompatible types
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'

toms 26. Feb 2005 20:09

Re: Wert von OleVariant überprüfen?
 
schreib's so:

Delphi-Quellcode:
Doc : IHTMLDocument3;

Delphi-Quellcode:
if Assigned(x) then
evtl. durch

Delphi-Quellcode:
if x <> nil then
ersetzen od. mit QueryInterface(..)


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:30 Uhr.
Seite 2 von 2     12   

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