楼主是不是在做外挂啊?如果是那样的话,那就是api模式鼠标点击。
解决方案 »
- 有一个txt文件,需要将文本读到dataset中,想请各位帮忙!!!
- 【求助】System.InvalidOperationException: 实例失败。
- C# 串口通信
- c# 数据绑定问题
- net2005中用oracle.dataaccess.client
- C# 连接 Excel
- 在vs2005中,关闭子窗体时如何使父窗体的控件(button)的enable属性为ture?
- 请哪位朋友帮我解决C#中的一个技术问题,谢谢
- 用动软生成的代码还没该就有错未能加载类型“Maticsoft.Web.Global”。
- c# primer???????(100分)
- 线程监听问题
- 关于计费程序数据库操求个好方法
public static extern int SetCursorPos(int x, int y); [DllImport("user32.dll", EntryPoint = "mouse_event")]
public static extern void mouse_event(
int dwFlags,
int dx,
int dy,
int cButtons,
int dwExtraInfo
); public const int MOUSEEVENTF_MOVE = 0x0001; //移动鼠标
public const int MOUSEEVENTF_LEFTDOWN = 0x0002; //模拟鼠标左键按下
public const int MOUSEEVENTF_LEFTUP = 0x0004; //模拟鼠标左键抬起
public const int MOUSEEVENTF_RIGHTDOWN = 0x0008; //模拟鼠标右键按下
public const int MOUSEEVENTF_RIGHTUP = 0x0010; //模拟鼠标右键抬起
public const int MOUSEEVENTF_MIDDLEDOWN = 0x0020; //模拟鼠标中键按下
public const int MOUSEEVENTF_MIDDLEUP = 0x0040;// 模拟鼠标中键抬起
public const int MOUSEEVENTF_ABSOLUTE = 0x8000; //标示是否采用绝对坐标 /// <summary>
///
/// </summary>
/// <param name="pSor">滚动条当前坐标</param>
/// <param name="pDst">滚动条目标坐标</param>
private static void MoveScroll(Point pSor,Point pDst)
{
mouse_event(Api.MOUSEEVENTF_LEFTDOWN, pSor.X, pSor.Y, 0, 0);
mouse_event(Api.MOUSEEVENTF_MOVE, pDst.X - pSor.X, pDst.Y - pSor.Y, 0, 0);
mouse_event(Api.MOUSEEVENTF_LEFTUP, pDst.X, pDst.Y, 0, 0);
}调用方法:
SetCursorPos(x,y);
MoveScroll(new Point(x, y), new Point(x, y + 20));
/// 发送信息
/// </summary>
/// <param name="hwnd"></param>
/// <param name="wMsg"></param>
/// <param name="wParam"></param>
/// <param name="lParam"></param>
/// <returns></returns>
[DllImport("user32.dll", EntryPoint = "SendMessageA")]
public static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam); [DllImport("USER32.DLL")]
public static extern IntPtr FindWindow(string lpClassName,
string lpWindowName); /// <summary>
///
/// </summary>
/// <param name="ptr">窗体句柄</param>
/// <param name="pSor">滚动条当前坐标</param>
/// <param name="pDst">滚动条目标坐标</param>
private static void MoveScroll2(IntPtr ptr, Point pSor, Point pDst)
{
//坐标信息
IntPtr lParam = (IntPtr)((pSor.Y << 16) | pSor.X);
IntPtr wParam = IntPtr.Zero;
const int leftdownCode = 0x201;
const int leftupCode = 0x202;
//移动鼠标时发生,同WM_MOUSEFIRST
const int WM_MOUSEMOVE = 0x200; SendMessage(ptr, leftdownCode, wParam, lParam);
lParam = (IntPtr)((pDst.Y << 16) | pDst.X);
SendMessage(ptr, WM_MOUSEMOVE, wParam, lParam);
SendMessage(ptr, leftupCode, wParam, lParam);
}调用方法:
IntPtr ptrQQ = Api.FindWindow(null, "QQ2013");
if (ptrQQ != IntPtr.Zero)
{
MoveScroll2(ptrQQ,new Point(x, y), new Point(x, y + MoveDown));
}