
07.08.2009, 08:21
|
 |
Прохожий
|
|
Регистрация: 08.06.2006
Адрес: Беларусь, Минск
Сообщения: 4
Репутация: 10
|
|
Добраться до фрейма
С помощью следующего примера можно получить html код открытых страниц внешнего браузера. Помогите, пожалуйста, доработать чтобы получать html код только из определенного фрейма определенной страницы.
PHP код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
uses
SHDocVw,
MSHTML;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
ShellWindow: IShellWindows;
WB: IWebbrowser2;
spDisp: IDispatch;
IDoc1: IHTMLDocument2;
k: Integer;
begin
ShellWindow := CoShellWindows.Create;
for k := 0 to ShellWindow.Count do
begin
spDisp := ShellWindow.Item(k);
if spDisp = nil then Continue;
spDisp.QueryInterface(iWebBrowser2, WB);
if WB <> nil then
begin
WB.Document.QueryInterface(IHTMLDocument2, iDoc1);
if iDoc1 <> nil then
begin
WB := ShellWindow.Item(k) as IWebbrowser2;
begin
Memo1.Lines.Add('****************************************');
Memo1.Lines.Add(WB.LocationURL);
Memo1.Lines.Add('****************************************');
Memo1.Lines.Add((WB.Document as IHTMLDocument2).body.outerHTML);
end;
end;
end;
end;
end;
end.
|