IHTMLWindow2.document
От: RuberoiD  
Дата: 03.10.02 03:57
Оценка:
Такая проблема:

procedure TForm1.Button1Click(Sender: TObject);
var
i : integer;
s : string;
ov : OleVariant;
iDoc : IHTMLDocument2;
iDisp : IDispatch;
iFrames2 : IHTMLFramesCollection2;
iWindow2 : IHTMLWindow2;
iFrameDoc : IHTMLDocument2;
begin
iDoc:=Form1.Browser1.ControlInterface.Document as IHTMLDocument2;
iFrames2:=iDoc.frames as IHTMLFramesCollection2;
for i:=1 to iFrames2.length do
begin
ov:=i-1;
iDisp:=iFrames2.item(ov);
iDisp.QueryInterface(IHTMLWindow2,iWindow2);
iWindow2.document.QueryInterface(IHTMLDocument2,iFrameDoc);
{ВЫДАЕТ ОШИБКУ "НЕТ ДОСТУПА"}
s:=iFrameDoc.title;
end;
end;
Re: IHTMLWindow2.document
От: SVV Беларусь  
Дата: 03.10.02 09:39
Оценка:
Здравствуйте RuberoiD, Вы писали:

RD>Такая проблема:


RD>procedure TForm1.Button1Click(Sender: TObject);

RD>var
RD> i : integer;
RD> s : string;
RD> ov : OleVariant;
RD> iDoc : IHTMLDocument2;
RD> iDisp : IDispatch;
RD> iFrames2 : IHTMLFramesCollection2;
RD> iWindow2 : IHTMLWindow2;
RD> iFrameDoc : IHTMLDocument2;
RD>begin
RD> iDoc:=Form1.Browser1.ControlInterface.Document as IHTMLDocument2;
RD> iFrames2:=iDoc.frames as IHTMLFramesCollection2;
RD> for i:=1 to iFrames2.length do
RD> begin
RD> ov:=i-1;
RD> iDisp:=iFrames2.item(ov);
RD> iDisp.QueryInterface(IHTMLWindow2,iWindow2);
RD> iWindow2.document.QueryInterface(IHTMLDocument2,iFrameDoc);
RD> {ВЫДАЕТ ОШИБКУ "НЕТ ДОСТУПА"}
RD> s:=iFrameDoc.title;
RD> end;
RD>end;

На C++ это делается так:

IHTMLDocument2  *pDoc2 = NULL;
IHTMLWindow2    *pWin2 = NULL;
// иниц-я pUnk...
pUnk->QueryInterface (__uuidof(IHTMLDocument2), (void**)&pDoc2);
if (pDoc2==NULL)
  return;
pDoc2->get_parentWindow(&pWin2);


возможно сначала нужно получить коллекцию фреймов, потом IHTMLWindow2 нужного фрейма и уж потом IHTMLDocument2...
Re: IHTMLWindow2.document
От: old Dutchman Беларусь http://blogs.rsdn.org/ikemefula
Дата: 03.10.02 10:44
Оценка:
Здравствуйте RuberoiD, Вы писали:

RD>Такая проблема:


RD>procedure TForm1.Button1Click(Sender: TObject);

RD>var
RD> i : integer;
RD> s : string;
RD> ov : OleVariant;
RD> iDoc : IHTMLDocument2;
RD> iDisp : IDispatch;
RD> iFrames2 : IHTMLFramesCollection2;
RD> iWindow2 : IHTMLWindow2;
RD> iFrameDoc : IHTMLDocument2;
RD>begin
RD> iDoc:=Form1.Browser1.ControlInterface.Document as IHTMLDocument2;
RD> iFrames2:=iDoc.frames as IHTMLFramesCollection2;
RD> for i:=1 to iFrames2.length do
RD> begin
RD> ov:=i-1;
RD> iDisp:=iFrames2.item(ov);
RD> iDisp.QueryInterface(IHTMLWindow2,iWindow2);
RD> iWindow2.document.QueryInterface(IHTMLDocument2,iFrameDoc);

iFrameDoc = iWindow2.document as IHTMLDocument2; // А так проходит?

RD> {ВЫДАЕТ ОШИБКУ "НЕТ ДОСТУПА"}

RD> s:=iFrameDoc.title;
RD> end;
RD>end;
Re[2]: IHTMLWindow2.document
От: RuberoiD  
Дата: 03.10.02 11:16
Оценка:
Здравствуйте old Dutchman

Нет... не проходит! Та же ошибка...
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.