Browse Source

+ distinguish between left and right shift and detect num/caps/lock key down using GetKeyState

git-svn-id: branches/unicodekvm@40330 -
nickysn 6 years ago
parent
commit
55c9af86f4
1 changed files with 10 additions and 0 deletions
  1. 10 0
      packages/rtl-console/src/win/keyboard.pp

+ 10 - 0
packages/rtl-console/src/win/keyboard.pp

@@ -177,6 +177,16 @@ procedure HandleKeyboard(var ir:INPUT_RECORD);
       Include(b,essCapsLockOn);
       Include(b,essCapsLockOn);
     if ControlKeyState and SCROLLLOCK_ON <> 0 then
     if ControlKeyState and SCROLLLOCK_ON <> 0 then
       Include(b,essScrollLockOn);
       Include(b,essScrollLockOn);
+    if (GetKeyState(VK_LSHIFT) and $8000) <> 0 then
+      b:=b+[essShift,essLeftShift];
+    if (GetKeyState(VK_RSHIFT) and $8000) <> 0 then
+      b:=b+[essShift,essRightShift];
+    if (GetKeyState(VK_NUMLOCK) and $8000) <> 0 then
+      Include(b,essNumLockPressed);
+    if (GetKeyState(VK_CAPITAL) and $8000) <> 0 then
+      Include(b,essCapsLockPressed);
+    if (GetKeyState(VK_SCROLL) and $8000) <> 0 then
+      Include(b,essScrollLockPressed);
     transEnhShiftState := b;
     transEnhShiftState := b;
   end;
   end;