Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class Form1 : Form
- {
- [DllImport("user32.dll", CharSet = CharSet.Auto)]
- public static extern void mouse_event(UInt32 dwFlags, UInt32 dx, UInt32 dy, UInt32 dwData, IntPtr dwExtraInfo);
- [DllImport("USER32.DLL", CharSet = CharSet.Unicode)]
- public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
- [DllImport("USER32.DLL")]
- public static extern bool SetForegroundWindow(IntPtr hWnd);
- public void DoMouseClick()
- {
- Cursor.Position = new Point(this.Location.X + 670, this.Location.Y + 311);
- int X = Cursor.Position.X;
- int Y = Cursor.Position.Y;
- MouseEventArgs click = new MouseEventArgs(MouseButtons.Left, X, Y, 1, 30);
- const UInt32 MOUSEEVENTF_LEFTDOWN = 0x2;//left mouse down
- const UInt32 MOUSEEVENTF_LEFTUP = 0x4; //left mouse up
- mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, IntPtr.Zero);
- mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, IntPtr.Zero);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement