Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. public partial class Form1 : Form
  2. {
  3. [DllImport("user32.dll", CharSet = CharSet.Auto)]
  4. public static extern void mouse_event(UInt32 dwFlags, UInt32 dx, UInt32 dy, UInt32 dwData, IntPtr dwExtraInfo);
  5. [DllImport("USER32.DLL", CharSet = CharSet.Unicode)]
  6. public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
  7. [DllImport("USER32.DLL")]
  8. public static extern bool SetForegroundWindow(IntPtr hWnd);
  9.  
  10. public void DoMouseClick()
  11. {
  12. Cursor.Position = new Point(this.Location.X + 670, this.Location.Y + 311);
  13. int X = Cursor.Position.X;
  14. int Y = Cursor.Position.Y;
  15. MouseEventArgs click = new MouseEventArgs(MouseButtons.Left, X, Y, 1, 30);
  16. const UInt32 MOUSEEVENTF_LEFTDOWN = 0x2;//left mouse down
  17. const UInt32 MOUSEEVENTF_LEFTUP = 0x4; //left mouse up
  18. mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, IntPtr.Zero);
  19. mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, IntPtr.Zero);
  20. }
  21.  
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement