如何做一个后台运行的浏览器,让它找出网页中特定的链接并模拟鼠标方式点击。比如:
在某网页中有一个这样的链接:http://www.163.com,程序发现它后,模拟鼠标方式点击它(当然不是人为的操作鼠标点击它,也不要程序控制鼠标移动到该链接上点击)。最好是附上可运行的代码,谢谢各位。
在某网页中有一个这样的链接:http://www.163.com,程序发现它后,模拟鼠标方式点击它(当然不是人为的操作鼠标点击它,也不要程序控制鼠标移动到该链接上点击)。最好是附上可运行的代码,谢谢各位。
ddeman;function GetURL(Service: string): string;
var
ClDDE: TDDEClientConv;
temp: PChar;
begin
Result := '';
//create a new DDE Client object
ClDDE := TDDEClientConv.Create(nil);
with ClDDE do
begin
SetLink(Service, 'WWW_GetWindowInfo');
temp := RequestData('0xFFFFFFFF');
Result := StrPas(temp);
StrDispose(temp);
CloseLink;
end;
ClDDE.Free;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
// the result should be something like:
// "http://www.swissdelphicenter.ch","SwissDelphiCenter.ch"
ShowMessage(GetURL('IExplore'));
{ ShowMessage(GetURL('Netscape')); }
end;{**************************************}
// To have the locationurls from all running instances of Internet Explorer -
// including open folders and Windows Explorer - shown in a listbox.
// by http://www.euromind.com/iedelphi/uses
shdocvw_tlb;
procedure TForm1.Button2Click(Sender: TObject);
var
x: Integer;
Sw: IShellWindows;
begin
sw := CoShellWindows.Create;
for x := 0 to SW.Count - 1 do
Listbox1.Items.Add((Sw.Item(x) as IWebbrowser2).LocationUrl);
end;