请问如何获取指定窗口的坐标
然后再用Mouse Event 点击该窗口的指定位置该如何实现.
本人菜鸟希望有高手能发代码上来供测试.
然后再用Mouse Event 点击该窗口的指定位置该如何实现.
本人菜鸟希望有高手能发代码上来供测试.
解决方案 »
- 菜鸟再问一个关系数据库记录复制的问题!
- 这样的要求,需要掌握怎么技术,能拿多少薪水?
- 关于数据表的操作,希望大家帮我一下
- 软件在WIN98下变了字体,不知道怎么办?在线等
- 如何调用VC的DLL?(搞定给500分)
- 能不能自己调TForm的color?
- 有使用oracle做开发库的朋友吗?请推荐一个使用起来更方便的oracle帮助文档好吗?谢谢!
- 安装文件是在搞不定了,今天又要交,哪位可以帮我做一下,谢谢了!!!!分不够的话可以在加!
- 请问如何将String变量类型转换为TForm变量类型。谢谢!
- 如何从指定的剪贴板向dxDBGrid中拷贝数据?
- COMM通信 第一个字节丢了
- 帮忙找找问题,程序无法正常运行会死掉。
procedure TForm1.Button1Click(Sender: TObject);
var
x,y:integer;
begin
x:= form1.Left+button2.Left+25;
y:= top+button2.Top+27;
SetCursorPos(x,y);
Mouse_Event(MOUSEEVENTF_LEFTDOWN,X,Y,0,0);
Mouse_Event(MOUSEEVENTF_LEFTUP,X,Y,0,0);
end;procedure TForm1.Button2Click(Sender: TObject);
begin
showmessage('fksj');
end;
*************************************
// Set the mouse cursor to position x,y:
SetCursorPos(x, y);
// Simulate the left mouse button down
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
// Simulate the right mouse button down
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
BOOL GetWindowRect(
HWND hWnd, // handle to window
LPRECT lpRect // address of structure for window coordinates
);
P: TPoint;
R: TRect;
begin
if Windows.GetClientRect(H, R) then //获取客户区大小,不含标题栏及边框
begin
P := R.TopLeft; //取左上角
Windows.ClientToScreen(H, P); //转换成屏幕坐标
OffsetRect(R, P.X, P.Y); //移动Rect,相当于转换成屏幕坐标
end;
end;