problem webbrowser i wyswietlanie zawartosci ramek

0

Moj program ma
wchodzic na strone www.xxx.pl i wyssietlac/zapisywac zawartosc kazdej ramki sie tam znajdujacej najlepiej jak by to robil zaraz po wczytaniu strony

Ogolnie juz mi to dziala ale nie do konca a mianowicie

  1. jesli na stronce jest przekierowanie to wyswietla mi tylko glowna 1 ramke
  2. gdy jednak omine przekierowanie i wejde na strone www.yyy.pl to mi dziala zapisywanie ramek jednak po tej operacji twebbrowser odmawia wspolpracy tz jak klikne na stronce jakis butom to wyswietla mi sie pusta stronka :(

moj kod

procedure TMainForm.Button2Click(Sender: TObject);
begin
  SaveWBFrames(Webbrowser1);

end;


function TMainForm.SaveWBFrames(WebBrowser1: TWebBrowser): string;
var
  Webdoc, HTMLDoc: ihtmldocument2;
  framesCol: iHTMLFramesCollection2; 
  FramesLen: integer;
  pickFrame: olevariant;
  p: integer;
begin
  try
    WebDoc := WebBrowser1.Document as IHTMLDocument2;
    Result := GetFrameSource(WebDoc);

    // §§§ Hier kann Result in eine Datei gespeichert werden §§§§  oder  mit
    WB_SaveFrameToFile(WebDoc,'c:\MainPage.html');

    //Handle multiple or single frames
    FramesCol := WebDoc.Get_frames;
    FramesLen := FramesCol.Get_length;
    if FramesLen > 0 then
      for p := 0 to FramesLen - 1 do
      begin
        pickframe := p;
        HTMLDoc   := WebBrowser1.Document as iHTMLDocument2;

        WebDoc := GetBrowserForFrame(HTMLDoc, pickframe).document as iHTMLDocument2;
        if WebDoc <> nil then
        begin
          Result := GetFrameSource(WebDoc);
          // §§§ Hier kann Result in eine Datei gespeichert werden §§§§  oder  mit
          WB_SaveFrameToFile(WebDoc, 'c:\Frame' + IntToStr(p) + '.html');
          // Wie bekommt man den Namen für ein Frame ??
          // so?
          // ShowMessage(HTMLDoc.Get_parentWindow.Get_name);
          // ShowMessage(HTMLDoc.Get_parentWindow.Parent.Get_document.nameProp);

        end;
      end;
  except
    Result := 'No Source Available';
  end;
end;

function TMainForm.WB_SaveFrameToFile(HTMLDocument: IHTMLDocument2;
  const FileName: TFileName): Boolean;
var
  PersistFile: IPersistFile;
begin
  PersistFile := HTMLDocument as IPersistFile;
  PersistFile.Save(StringToOleStr(FileName), System.True);
end;
0

jest ktoś w stanie mi pomóc??

0

ratunku moj caly program stoi musze to omniać ktoś ma jakiś pomysł

ma ktos jakas koncepcje??

0

Cos czuje ze nikt nie jest tu tak ambitny by mi pomoc

0

oki poradzilem sobie
w inny calkiem sposob i dziala tak jak chcailem w chwili gdy sie ramka zaladuje mam dostep do jej kodu html :P nie wklejam kogu poniewaz widzse, że nikogo to nie inetresuje

1 użytkowników online, w tym zalogowanych: 0, gości: 1