From f0c27fbbace461abc6e61dea57a0a91aae8f4acc Mon Sep 17 00:00:00 2001 From: Sleevezipper Date: Mon, 24 May 2021 13:35:53 +0200 Subject: [PATCH] add keyup event. fixes #75 --- hass-workstation-service/Domain/Commands/KeyCommand.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hass-workstation-service/Domain/Commands/KeyCommand.cs b/hass-workstation-service/Domain/Commands/KeyCommand.cs index bf66e9e..4da4e5a 100644 --- a/hass-workstation-service/Domain/Commands/KeyCommand.cs +++ b/hass-workstation-service/Domain/Commands/KeyCommand.cs @@ -11,7 +11,7 @@ namespace hass_workstation_service.Domain.Commands public class KeyCommand : AbstractCommand { public const int KEYEVENTF_EXTENTEDKEY = 1; - public const int KEYEVENTF_KEYUP = 0; + public const int KEYEVENTF_KEYUP = 0x0002; public const int VK_MEDIA_NEXT_TRACK = 0xB0; public const int VK_MEDIA_PLAY_PAUSE = 0xB3; public const int VK_MEDIA_PREV_TRACK = 0xB1; @@ -54,7 +54,8 @@ namespace hass_workstation_service.Domain.Commands public override void TurnOn() { - keybd_event(this.KeyCode, 0, KEYEVENTF_EXTENTEDKEY, IntPtr.Zero); + keybd_event(this.KeyCode, 0, 0, IntPtr.Zero); + keybd_event(this.KeyCode, 0, KEYEVENTF_KEYUP, IntPtr.Zero); } } }