实现打开IE浏览器并打开指定网页,移动鼠标到指定坐标并左键单击,但是运行出错,不知道错在什么地方了,请指点一下,
procedure TForm1.Button1Click(Sender: TObject);begin
ShellExecute(Handle, 'open', 'IExplore.EXE', 'http://www.126.com', nil, SW_SHOWNORMAL);
sleep(5000);
setcursorpos(500,500);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
end;
procedure TForm1.Button1Click(Sender: TObject);begin
ShellExecute(Handle, 'open', 'IExplore.EXE', 'http://www.126.com', nil, SW_SHOWNORMAL);
sleep(5000);
setcursorpos(500,500);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
end;
解决方案 »
- 为什么我从Delphi编写的界面的文本框中COPY的汉字,到了别的程序就变成了乱码?
- 怎么得到系统的日期格式?
- 关于直接用代码创建控件
- 在程序中用sql语句在access中增加字段问题!!!!,在线等待
- DBGrid的字段名称动态变动
- 给一组数字,列出组合/
- 怎么把数据备份到客户端????
- 请问如何打印canvas上的内容?包括文字、线条等???
- 急!给你 N 个字符串(N =1~5),如何获取这 N 个字符串最长的公共部分?
- 菜鸟问题:谁来澄清一下概念?ANSI字符,UNICODE,宽字符,窄字符,多字节字符集...
- SendMessage 隐藏窗口的方法
- SQL两表对比单价,不同则显示出来
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ShellAPI; (没有加载SHELLAPI)type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(Handle, 'open', 'IExplore.EXE', 'http://www.126.com', nil, SW_SHOWNORMAL);
sleep(5000);
setcursorpos(500,500);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
end;end.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,shellapi, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
shellexecute(0,'open',pchar('C:\Program Files\Internet Explorer\IEXPLORE.EXE'),pchar('http://www.baidu.com/'),0,sw_showmaximized);
sleep(8000);
setcursorpos(0,0);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
end;end.