using UnityEngine;
using System.Collections;
using System.Diagnostics;
public class NewBehaviourScript1 : MonoBehaviour {
[System.Runtime.InteropServices.DllImport("user32")]//导入user32这个dll文件,其实我们用到的模拟鼠标按键已经封装在这个windows下的文件里了
private static extern int mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo); //引用user32.dll中的方法,下面同理:
unity3d学习教程 自动打卡程序 模拟鼠标按键代码
[System.Runtime.InteropServices.DllImport("user32")]
private static extern bool SetCursorPos(int x, int y);
const int MOUSEEVENTF_MOVE = 0x0001; //定义鼠标状态
const int MOUSEEVENTF_LEFTDOWN = 0x0002;
const int MOUSEEVENTF_LEFTUP = 0x0004;
const int MOUSEEVENTF_RIGHTDOWN = 0x0008;
const int MOUSEEVENTF_RIGHTUP = 0x0010;
const int MOUSEEVEN