(CodeLib-Manager)
Registriert seit: 10. Jun 2002
4.648 Beiträge
Delphi XE Professional
|
Re: Twebbrowser type=image anklicken
20. Mär 2008, 22:08
Hallo,
Probiere mal meine WB_ClickImage() Funktion:
Delphi-Quellcode:
procedure WB_ClickImage(WB: TWebbrowser; ImageSRC: string);
var
iDoc: IHtmlDocument2;
i: Integer;
iDisp: IDispatch;
iColl: IHTMLElementCollection;
InputImage: HTMLInputImage;
begin
if Assigned(WB.Document) then
begin
WB.Document.QueryInterface(IHTMLDocument2, iDoc);
if Assigned(iDoc) then
begin
iDisp := iDoc.all.tags('INPUT');
if Assigned(iDisp) then
begin
iDisp.QueryInterface(IHTMLElementCollection, iColl);
if Assigned(iColl) then
begin
ImageSRC := AnsiUpperCase(ImageSRC);
for i := 1 to iColl.Get_length do
begin
iDisp := iColl.item(Pred(i), 0);
iDisp.QueryInterface(HTMLInputImage, InputImage);
if Assigned(InputImage) then
begin
if Pos(ImageSRC, AnsiUpperCase(InputImage.src)) <> 0 then
begin
InputImage.Click;
end;
end;
end;
end;
end;
end;
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
WB_ClickImage(Webbrowser1, 'blablabla.gif');
end;
Thomas
|
|
Zitat
|