コード例 #1
0
        public static void PressKey(MemoryApi.KeyCode vk, bool press)
        {
            var lowOrderByte = (ushort)((ushort)vk & 0xff);
            var scanCode     = (ushort)MemoryApi.MapVirtualKey(lowOrderByte, 0);

            //Console.WriteLine("SendInput:: VK: " + (ushort)vk + " (" + vk + ") <-> SC: " + (ushort)(scanCode & 0xff));

            if (press)
            {
                KeyDown(scanCode);
            }
            else
            {
                KeyUp(scanCode);
            }
        }
コード例 #2
0
 public static bool IsKeyLocked(MemoryApi.KeyCode vk)
 {
     return((((ushort)MemoryApi.GetKeyState((int)vk)) & 0xffff) != 0);
 }
コード例 #3
0
 public static bool IsKeyPushedDown(MemoryApi.KeyCode vKey)
 {
     return(0 != (MemoryApi.GetAsyncKeyState((int)vKey) & 0x8000));
 }
コード例 #4
0
 public static void HumanKeyPress(MemoryApi.KeyCode vk)
 {
     PressKey(vk, true);
     Thread.Sleep(Utils.getRandom(100, 300));
     PressKey(vk, false);
 }