AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi Saving Document XML Source from TWebbrowser
Thema durchsuchen
Ansicht
Themen-Optionen

Saving Document XML Source from TWebbrowser

Ein Thema von Delphi-Lover · begonnen am 9. Okt 2006 · letzter Beitrag vom 10. Okt 2006
 
Delphi-Lover

Registriert seit: 19. Okt 2004
Ort: Amsterdam
30 Beiträge
 
Delphi 2005 Professional
 
#4

Re: Saving Document XML Source from TWebbrowser

  Alt 10. Okt 2006, 13:17
Hello,

On the web I've searched and searched, but my question seems a difficult problem. I found on a newsgroup someone with a similar problem.

View Source for WebBrowser control from C# program

Only the final solution the poster adds to the group as an attachment I can not find.
(The page above points not to the original newsgroup but to one of these newsgroup-collectors-sites)

But maybe it helps to understand the problem better.


here is the working code as how shmia wanted to do it.
(It works, but not solve the problem...)

Delphi-Quellcode:
var FileStream: TFileStream;

    procedure InternalSaveDocumentToStream(const Stream: TStream);
    var
      StreamAdapter: IStream;
      PersistStreamInit: IPersistStreamInit;
    begin
      Assert(Assigned(webbrowser.Document));
      if webbrowser.Document.QueryInterface(IPersistStreamInit, PersistStreamInit) = S_OK then
      begin
        StreamAdapter := TStreamAdapter.Create(Stream);
        PersistStreamInit.Save(StreamAdapter, False);
      end;
    end;

FileStream := TFileStream.Create('Return.xml', fmCreate);
try
  InternalSaveDocumentToStream(FileStream);
finally
  FileStream.Free;
end;
and here is code how to display the View-Source textbox.
(With the real source of the page, but it's an execute of a notepad session and I'm not able to save it in the delphi code...)

Delphi-Quellcode:

    procedure WBViewSourceDialog(AWebBrowser: TWebbrowser) ;
    const
      CGID_WebBrowser: TGUID = '{ED016940-BD5B-11cf-BA4E-00C04FD70816}';
      HTMLID_VIEWSOURCE = 2;

    var
      CmdTarget : IOleCommandTarget;
      vaIn, vaOut: OleVariant;
      PtrGUID: PGUID;
    begin
      New(PtrGUID) ;
      PtrGUID^ := CGID_WebBrowser;
      if AWebBrowser.Document <> nil then
        try
          AWebBrowser.Document.QueryInterface(IOleCommandTarget, CmdTarget) ;
          if CmdTarget <> nil then
          try
            CmdTarget.Exec(PtrGUID, HTMLID_VIEWSOURCE, 0, vaIn, vaOut) ;
          finally
            CmdTarget._Release;
          end;
        except
       end;
      Dispose(PtrGUID) ;
    end;

Greets,

Delphi-Lover.
Rob
  Mit Zitat antworten Zitat
 


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 12:48 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz