public void ReleaseKey(KeysEx keyCode)
		{
			uint intReturn = 0;
			INPUT structInput;
			structInput = new INPUT();
			structInput.type = (uint)1;
			structInput.ki.wScan = 0;
			structInput.ki.time = 0;
			structInput.ki.dwFlags = 0;
			structInput.ki.dwExtraInfo = 0;

			// Key up the actual key-code
			structInput.ki.dwFlags = NativeWin32.KEYEVENTF_KEYUP;
			structInput.ki.wVk = (ushort)keyCode;// (ushort)NativeWin32.KeysEx.SNAPSHOT;//vk;
			intReturn = NativeWin32.SendInput((uint)1, ref structInput, Marshal.SizeOf(structInput));
		}
		public void PressKey(KeysEx keyCode)
		{
			uint intReturn = 0;
			INPUT structInput;
			structInput = new INPUT();
			structInput.type = (uint)1;
			structInput.ki.wScan = 0;
			structInput.ki.time = 0;
			structInput.ki.dwFlags = 0;
			structInput.ki.dwExtraInfo = 0;
			// Key down the actual key-code

			structInput.ki.wVk = (ushort)keyCode; //KeysEx.SHIFT etc.
			intReturn = NativeWin32.SendInput(1, ref structInput, Marshal.SizeOf(structInput));
		}
示例#3
0
		public static extern uint SendInput(uint nInputs, ref INPUT pInputs, int cbSize);