1using System.Diagnostics;
2using System.Runtime.InteropServices;
9 [DllImport(
"User32.dll")]
20 public static bool GetKeyState(System.Windows.Forms.Keys vKey)
29 [DllImport(
"user32.dll")]
32 [DllImport(
"user32.dll")]
33 public static extern int GetWindowText(IntPtr hWnd, StringBuilder text,
int count);
34 [DllImport(
"user32.dll")]
36 [DllImport(
"user32.dll")]
37 public static extern void mouse_event(
int dwFlags,
int dx,
int dy,
int dwData,
int dwExtraInfo);
39 [StructLayout(LayoutKind.Sequential)]
67 [DllImport(
"user32.dll")]
86 Process pr = Process.GetProcessesByName(process)[0];
96 Process[] pr = Process.GetProcessesByName(
"winlogon");
107 const int nChars = 256;
108 StringBuilder Buff =
new StringBuilder(nChars);
113 return Buff.ToString();
140 [DllImport(
"user32.dll", EntryPoint =
"SetCursorPos")]
141 [
return: MarshalAs(UnmanagedType.Bool)]
142 private static extern bool SetCursorPos(
int x,
int y);
149 [DllImport(
"user32.dll")]
150 [
return: MarshalAs(UnmanagedType.Bool)]
151 private static extern bool GetCursorPos(out MousePoint lpMousePoint);
165 [DllImport(
"user32.dll")]
166 private static extern void mouse_event(
int dwFlags,
int dx,
int dy,
int dwData,
int dwExtraInfo);
217 SetCursorPos(point.
X, point.
Y);
226 var gotPoint = GetCursorPos(out currentMousePoint);
227 if (!gotPoint) { currentMousePoint =
new MousePoint(0, 0); }
228 return currentMousePoint;
248 [StructLayout(LayoutKind.Sequential)]
static MousePoint GetCursorPosition()
static void MouseEvent(MouseEventFlags value)
static void RightDown()
It sends a message to the operating system that the right mouse button has been pressed.
static void LeftDown()
The function takes the mouse event flag and calls the mouse event function.
static void SetCursorPosition(MousePoint point)
static void SetCursorPosition(int x, int y)
const int MOUSEEVENTF_ABSOLUTE
const int MOUSEEVENTF_RIGHTDOWN
const int MOUSEEVENTF_HWHEEL
static short GetAsyncKeyState(System.Windows.Forms.Keys vKey)
const int MOUSEEVENTF_RIGHTUP
const int MOUSEEVENTF_MIDDLEUP
static bool GetKeyState(System.Windows.Forms.Keys vKey)
static int GetWindowText(IntPtr hWnd, StringBuilder text, int count)
static string GetActiveWindowTitle()
const int MOUSEEVENTF_XUP
static bool RunningOnWine()
const int MOUSEEVENTF_XDOWN
const int MOUSEEVENTF_MOVE
static bool GetWindowRect(IntPtr hwnd, ref Rect rectangle)
const int MOUSEEVENTF_LEFTDOWN
const int MOUSEEVENTF_MIDDLEDOWN
const int MOUSEEVENTF_WHEEL
static void MouseWheelDown()
MouseWheelDown() simulates a mouse wheel down event.
static void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo)
static IntPtr GetForegroundWindow()
static void SetFocus(string process)
static bool SetForegroundWindow(IntPtr hWnd)
static void MouseWheelUp()
"MouseWheelUp()" is a function that simulates a mouse wheel up event.
const int MOUSEEVENTF_LEFTUP