赞
踩
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Drawing;//获取分辨率用,下文的Height,Width
using System.Windows.Forms;//获取屏幕用,下文的 Screen
using System.Threading;//暂停用
namespace mouserange
{
class Program
{
[DllImport("user32.dll", EntryPoint = "SetCursorPos")]//控制鼠标位置aip
private static extern int SetCursorPos(int x, int y);//控制鼠标位置aip
static void Main(string[] args)
{
int Hights = Screen.PrimaryScreen.Bounds.Height;//获取高
int Widths = Screen.PrimaryScreen.Bounds.Width;//获取宽
int i = 0;
while (true)
{
Random rd = new Random();//new随机数对象
int h = rd.Next(0, Hights); //高:生成随机数
int w = rd.Next(0, Widths); //宽:生成随机数
SetCursorPos(w, h); //鼠标位置
Thread.Sleep(20);
}
}
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。