我试图在C#中为mu在线游戏构建AutoClicker。 我能用自己的咔哒声做出来,所有的工作都很完美, 但我不知道我怎么能使点击器只在游戏exe中工作, 我的意思是如果exe最小化(例如) 我浏览互联网或其他东西,点击器继续工作 在游戏exe(Mu Online)中。 知道我怎么能这样做吗?
我用过:
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
static extern bool SetCursorPos(uint x, uint y);
[DllImport("user32.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, UIntPtr dwExtraInfo);
private const uint MOUSEEVENTF_MOVE = 0x0001;
private const uint MOUSEEVENTF_LEFTDOWN = 0x0002;
private const uint MOUSEEVENTF_LEFTUP = 0x0004;
private const uint MOUSEEVENTF_RIGHTDOWN = 0x0008;
private const uint MOUSEEVENTF_RIGHTUP = 0x0010;
private const uint MOUSEEVENTF_ABSOLUTE = 0x8000;
感谢您的帮助!