admin管理员组文章数量:1533872
2024年5月13日发(作者:)
c# 调用API控制鼠标移动单击双击以及滚轮的公共类
using System;
using ;
using pServices; using g;
using ;
namespace KeyboardHook
{
///
/// Mouse buttons that can be pressed
///
public enum MouseButton
{
Left = 0x2,
Right = 0x8,
Middle = 0x20
}
///
/// Operations that simulate mouse events
///
public static class MouseSimulator
{
#region Windows API Code
[DllImport("")]
static extern int ShowCursor(bool show);
[DllImport("User32")]
public extern static void SetCursorPos(int x, int y);
[DllImport("")]
static extern void mouse_event(int flags, int dX, int dY, int
buttons, int
extraInfo);
[DllImport("")]
static extern void PostMessage(IntPtr hWnd, int Msg, int wParam,
uint
lParam);
const int MOUSEEVENTF_MOVE = 0x1;
const int MOUSEEVENTF_LEFTDOWN = 0x2;
const int MOUSEEVENTF_LEFTUP = 0x4;
const int MOUSEEVENTF_RIGHTDOWN = 0x8;
const int MOUSEEVENTF_RIGHTUP = 0x10;
const int MOUSEEVENTF_MIDDLEDOWN = 0x20;
const int MOUSEEVENTF_MIDDLEUP = 0x40;
const int MOUSEEVENTF_WHEEL = 0x800;
const int MOUSEEVENTF_ABSOLUTE = 0x8000;
const int WM_MOUSEMOVE = 0x200;
const int WM_LBUTTONDOWN = 0x201;
const int WM_RBUTTONDOWN = 0x204;
const int WM_MBUTTONDOWN = 0x207;
版权声明:本文标题:c#调用API控制鼠标移动单击双击以及滚轮的公共类 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1715607974a460793.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论