AnonymousBOL

Hotkey Soruce

Mar 22nd, 2015
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 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.Runtime.InteropServices;
  7.  
  8. namespace ConsoleApplication3
  9. {
  10.     class Program
  11.     {
  12.         [DllImport("user32.dll")]
  13.         public static extern short GetAsyncKeyState(int vKey);
  14.         static void Main(string[] args)
  15.         {
  16.             Console.Title = "C# External - Hotkeye";
  17.             while (true)
  18.             {
  19.                 for (int i = 0; i < 255; i++)
  20.                 {
  21.                     if (GetAsyncKeyState(i) != 0)
  22.                     {
  23.                         Console.WriteLine("Hotkey: 0x" + i.ToString("X"));
  24.                     }
  25.                 }
  26.                 System.Threading.Thread.Sleep(1);
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment