Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. public class SendKey
  2. {
  3. const UInt32 WM_KEYDOWN = 0x0100;
  4. private const UInt32 WM_KEYUP = 0x0101;
  5. const int VK_F5 = 0x74;
  6.  
  7. [DllImport("user32.dll")]
  8. static extern bool PostMessage(IntPtr hWnd, UInt32 Msg, int wParam, int lParam);
  9.  
  10. public static void Send()
  11. {
  12. Process[] processes = Process.GetProcessesByName("Oblivion");
  13.  
  14. foreach (Process proc in processes)
  15. {
  16. PostMessage(proc.MainWindowHandle, WM_KEYDOWN, VK_F5, 0);
  17. Thread.Sleep(200);
  18. PostMessage(proc.MainWindowHandle, WM_KEYUP, VK_F5, 0);
  19. }
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement