Si, sigo usando Delphi 2006.
De todas formas ya lo solucioné, importé el ActiveX "Microsoft HTML Object Library" que me hizo un MSHTML_TLB.pas con la clase IHTMLDocument2 que también permite leer el código fuente de los frames:
Código Delphi
[-]
function GetBrowserForFrame(Doc: IHTMLDocument2; nFrame: Integer): IWebBrowser2;
var
pContainer: IOLEContainer;
enumerator: ActiveX.IEnumUnknown;
nFetched: PLongInt;
unkFrame: IUnknown;
hr: HRESULT;
begin
Result := nil;
nFetched := nil;
pContainer := Doc as IOleContainer;
hr := pContainer.EnumObjects(OLECONTF_EMBEDDINGS or OLECONTF_OTHERS, enumerator);
if hr <> S_OK then
begin
pContainer._Release;
Exit;
end;
enumerator.Skip(nFrame);
enumerator.Next(1,unkFrame, nFetched);
unkframe.QueryInterface(IID_IWebBrowser2, Result);
end;
function GetFrameSource(WebDoc: iHTMLDocument2): string;
var
re: integer;
HTMLel: iHTMLElement;
HTMLcol: iHTMLElementCollection;
HTMLlen: Integer;
ScriptEL: IHTMLScriptElement;
begin
Result := '';
if Assigned(WebDoc) then
begin
HTMLcol := WebDoc.Get_all;
HTMLlen := HTMLcol.Length;
for re := 0 to HTMLlen - 1 do
begin
HTMLel := HTMLcol.Item(re, 0) as iHTMLElement;
if HTMLEl.tagName = 'HTML' then
Result := Result + HTMLEl.outerHTML;
end;
end;
end;
procedure TF_Principal.ObtenerHTML(Num:SmallInt);
var
Webdoc, HTMLDoc: ihtmldocument2;
framesCol: iHTMLFramesCollection2;
FramesLen: integer;
pickFrame: olevariant;
p: integer;
HTML : String;
iFrame : IWebBrowser2;
begin
if WB <> nil then
try
WebDoc := WB.Document as IHTMLDocument2;
HTML := GetFrameSource(WebDoc);
AnalizarHTML(HTML);
FramesCol := WebDoc.Get_frames;
FramesLen := FramesCol.Get_length;
if FramesLen > 0 then
for p := 0 to FramesLen - 1 do
begin
pickframe := p;
HTMLDoc := WB.Document as iHTMLDocument2;
iFrame := GetBrowserForFrame(HTMLDoc, pickframe);
if iFrame <> nil then
begin
WebDoc := iFrame.document as iHTMLDocument2;
if WebDoc <> nil then
begin
HTML := GetFrameSource(WebDoc);
AnalizarHTML(HTML);
end;
end;
end;
except
end;
end;
Saludos.