import cffi
ffi = cffi.FFI()
ffi.cdef(
"""
//MOUSEEVENTF_LEFTDOWN = 2
//MOUSEEVENTF_LEFTUP = 4
typedef struct Point{
int x;
int y;
}* LPPOINT;
BOOL GetCursorPos(LPPOINT lpPoint);
void mouse_event(
DWORD dwFlags,
DWORD dx,
DWORD dy,
DWORD dwData,
DWORD dwExtraInfo
);
""")
lppoint = ffi.new("struct Point *")
user32 = ffi.dlopen("user32.dll")
user32.GetCursorPos(lppoint)
user32.mouse_event(2, lppoint.x, lppoint.y, 0, 0)
user32.mouse_event(4, lppoint.x, lppoint.y, 0, 0)
网友评论