Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [System.Runtime.InteropServices.DllImport("user32.dll")]
- static extern bool SetCursorPos(int x, int y);
- [System.Runtime.InteropServices.DllImport("user32.dll")]
- public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
- public const int MOUSEEVENTF_LEFTDOWN = 0x02;
- public const int MOUSEEVENTF_LEFTUP = 0x04;
- //This simulates a left mouse click
- public static void LeftMouseClick(int xpos, int ypos)
- {
- SetCursorPos(xpos, ypos);
- mouse_event(MOUSEEVENTF_LEFTDOWN, xpos, ypos, 0, 0);
- mouse_event(MOUSEEVENTF_LEFTUP, xpos, ypos, 0, 0);
- }
- private void button1_Click(object sender, EventArgs e)
- {
- HookToS1(); //Hook to the process, see Github for complete method
- SetForegroundWindow(s1); //See above
- //while (true) //Loop to get cursor position
- //Console.WriteLine(Cursor.Position);
- //Method x2 to double click. It works!
- LeftMouseClick(-900, 660);
- LeftMouseClick(-900, 660);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement