请问在一个有多个Frames的网页中,如何取得任何一个Frames中的TEXT的值??
最好有源码。
最好有源码。
解决方案 »
- 怎样读取服务器端文件的最后修改时间?在线急等
- 威视视频采集卡两路输入的问题 (已解决,速来接分)
- 如何读取access数据库里的内容
- 急!!!哪位大侠帮帮我!!(要是能完成就送100分)
- 关于消息的响应和处理的疑问!
- 关于Tstringgrid的多行选择问题!!
- 十万火急!!小弟倾家荡产了,想做个工资录入程序,望做过工资系统的大虾们进来看看我的思路是否正确。
- 天!image1.Picture.LoadFromFile('c:\1.jpg')为什么不成?
- 这样的查找功能用QUERY可以实现吗??
- 请给我一个在代码中用filter过滤记录的例子好吗?
- 菜鸟提问:DEPHII中如何像VB中一样创建控件数组
- 请教取cpu序列号问题????????
ActiveX; function TForm1.GetFrame(FrameNo: Integer): IWebbrowser2;
var
OleContainer: IOleContainer;
enum: IEnumUnknown;
unk: IUnknown;
Fetched: PLongint;
begin
while Webbrowser1.ReadyState <> READYSTATE_COMPLETE do
Application.ProcessMessages;
if Assigned(Webbrowser1.document) then
begin
Fetched := nil;
OleContainer := Webbrowser1.Document as IOleContainer;
OleContainer.EnumObjects(OLECONTF_EMBEDDINGS, Enum);
Enum.Skip(FrameNo);
Enum.Next(1, Unk, Fetched);
Result := Unk as IWebbrowser2;
end
else
Result := nil;
end; // Load sample page
// Testseite laden
procedure TForm1.Button1Click(Sender: TObject);
begin
Webbrowser1.Navigate('http://www.warebizprogramming.com/tutorials/html/framesEx1.htm');
end; // Save all frames in single files
// Alle Frameseiten in einzelne Dateien speichern
procedure TForm1.Button2Click(Sender: TObject);
var
IpStream: IPersistStreamInit;
AStream: TMemoryStream;
iw: IWebbrowser2;
i: Integer;
sl: TStringList;
begin
for i := 0 to Webbrowser1.OleObject.Document.frames.Length - 1 do
begin
iw := GetFrame(i);
AStream := TMemoryStream.Create;
try
IpStream := iw.document as IPersistStreamInit;
if Succeeded(IpStream.save(TStreamadapter.Create(AStream), True)) then
begin
AStream.Seek(0, 0);
sl := TStringList.Create;
sl.LoadFromStream(AStream);
sl.SaveToFile('c:\frame' + IntToStr(i) + '.txt');
// memo1.Lines.LoadFromStream(AStream);
sl.Free;
end;
except
end;
AStream.Free;
end;
end; end.
var
IEApp,Docs,oIFrame,ovElements: OLEVariant;
i: integer;
begin
IEApp := CreateOLEObject('InternetExplorer.Application');
IEApp.Visible := True;
IEApp.Navigate('http://www.xxx.com');
while IEApp.ReadyState < READYSTATE_COMPLETE do
Application.ProcessMessages; Docs := IEApp.Document;
oIFrame := Docs.Frames.item(0); //第一個Frame
//-- <input type="text" name=myName ID="myName"> //若有ID名
ovElements := oIFrame.Document.GetElementByID('myName');
Edit1.Text := ovElements.Value;
end;
我如何得到 'http://www.xxx.com' 这个网址呢?
我想做的是当把鼠标移到系统IE上时,能够得到上面TEXT的值。没有Frames的网页,我已经解决了,
可是有Frames的,该怎么取???