function MouseToScreen(mVertical: Boolean; mMouse: Integer): Integer;
begin
case mVertical of
False: Result := Round(mMouse * (MAXWORD / Screen.Width));
else
Result := Round(mMouse * (MAXWORD / Screen.Height));
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
vPoint: TPoint;
begin
vPoint.X := 500;
vPoint.Y := 350;
mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_MOVE,MouseToScreen(False, vPoint.X),
MouseToScreen(True, vPoint.Y), 0, 0);
mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTDOWN,
MouseToScreen(False, vPoint.X), MouseToScreen(True, vPoint.Y), 0, 0);
Dec(vPoint.X, 200);
Dec(vPoint.Y, 200);
mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_MOVE,MouseToScreen(False, vPoint.X),
MouseToScreen(True, vPoint.Y), 0, 0);
mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTUP,
MouseToScreen(False, vPoint.X), MouseToScreen(True, vPoint.Y), 0, 0);
end;
delphi 实现自动刷抖音
最新推荐文章于 2024-04-22 18:32:56 发布
这段代码定义了一个`MouseToScreen`函数,用于将鼠标坐标转换为屏幕坐标。在`Timer1Timer`事件中,它模拟了鼠标从(500, 350)位置按下,然后向左下移动200像素并释放的操作。这个过程可能用于自动化测试或者用户界面交互模拟。
摘要由CSDN通过智能技术生成