using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
using Microsoft.Win32;
using System.Threading;
namespace GameAssister
{
public partial class Form1 : Form
{
int hwnd; //窗体句柄
const uint WM_LBUTTONDOWN = 0x0201;//鼠标左键单击
const uint WM_LBUTTONUP = 0x0202;//鼠标左键抬起
const uint PROCESS_ALL_ACCESS = 0x1F0FFF; //定义内存权限
bool isStart = false;
public Form1()
{
InitializeComponent();
}
[DllImport("User32.dll", EntryPoint = "FindWindow")]
public static extern int FindWindow(string lpClassName, string lpWindowName); //通过窗体名获取窗体句柄
[DllImport("User32.dll", EntryPoint = "SendMessage")]
private static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); //通过获取的窗体句柄进行操作()
[DllImport("USER32.DLL")]
public static extern bool SetForegroundWindow(IntPtr hWnd);//根据获取的窗体句柄激活要控制的窗体
[DllImport("user32.dll", EntryPoint = "GetWindowThreadProcessId")]
public static extern uint GetWindowThreadProcessId(IntPtr hWnd, ref uint GamePID);//根据窗体句柄获取该程序进程ID
/// <summary>
/// 打开进程
/// </summary>
/// <param name="dwDesiredAccess">想得到的访问权限</param>
/// <param name="bInheritHandle">指定返回的句柄是否可以被继承</param>
/// <param name="dwProcessId">指定要打开的进程的ID</param>
/// <returns></returns>
[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(uint dwDesiredAccess, bool bInheritHandle, uint dwProcessId); //
[DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [MarshalAs(UnmanagedType.LPArray)] byte[,] lpBuffer, int nSize, ref uint vNumberOfBytesRead);
[DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, ref IntPtr lpBuffer, int nSize, ref uint vNumberOfBytesRead);
[DllImportAttribute("kernel32.dll")]
public static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byt
QQ对对碰源码
最新推荐文章于 2021-02-27 13:36:53 发布
这是一个利用C#编写的QQ对对碰自动助手,实现了自动点击、游戏加速和清除一对的功能。通过窗体句柄和Windows API调用来模拟鼠标操作,读取并修改游戏内存来获取游戏状态和实现加速功能。
摘要由CSDN通过智能技术生成