Advertisement
Guest User

Untitled

a guest
Jan 13th, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Diagnostics;
  7. using System.Runtime.InteropServices;
  8. using System.Threading;
  9. using WindowsInput;
  10. using WindowsInput.Native;
  11.  
  12. namespace ConsoleApp16
  13. {
  14.  
  15. static class Program
  16. {
  17. const UInt32 WM_KEYDOWN = 0x0100;
  18. const int VK_F5 = 0x74;
  19.  
  20. [DllImport("user32.dll")]
  21. static extern bool PostMessage(IntPtr hWnd, UInt32 Msg, int wParam, int lParam);
  22.  
  23. [STAThread]
  24. static void Main()
  25. {
  26. while (true)
  27. {
  28. Process[] processes = Process.GetProcessesByName("iexplore");
  29.  
  30. foreach (Process proc in processes)
  31. PostMessage(proc.MainWindowHandle, WM_KEYDOWN, VK_F5, 0);
  32.  
  33. Thread.Sleep(5000);
  34. }
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement