diff --git a/Pilz.Win32/Mapped/Keyboard.vb b/Pilz.Win32/Mapped/Keyboard.vb new file mode 100644 index 0000000..b3ce738 --- /dev/null +++ b/Pilz.Win32/Mapped/Keyboard.vb @@ -0,0 +1,19 @@ +Imports Pilz.Win32.Native + +Imports Keys = System.Windows.Forms.Keys + +Namespace Mapped + + Public Class Keyboard + + Public Shared Function IsKeyDown(keyCode As Integer) As Boolean + Return (User32.GetKeyState(keyCode) & &H8000) < 0 + End Function + + Public Shared Function IsKeyDown(keyCode As Keys) As Boolean + Return IsKeyDown(CInt(keyCode)) + End Function + + End Class + +End Namespace diff --git a/Pilz.Win32/Native/User32.vb b/Pilz.Win32/Native/User32.vb index cf69991..3fcce54 100644 --- a/Pilz.Win32/Native/User32.vb +++ b/Pilz.Win32/Native/User32.vb @@ -14,6 +14,10 @@ Namespace Native Public Shared Function ChildWindowFromPointEx(ByVal hWndParent As IntPtr, ByVal pt As POINT, ByVal uFlags As UInteger) As IntPtr End Function + + Public Shared Function GetKeyState(keyCode As Integer) As Short + End Function + End Class End Namespace diff --git a/Pilz.Win32/Pilz.Win32.vbproj b/Pilz.Win32/Pilz.Win32.vbproj index 14359cc..79a7177 100644 --- a/Pilz.Win32/Pilz.Win32.vbproj +++ b/Pilz.Win32/Pilz.Win32.vbproj @@ -28,7 +28,7 @@ True 1.yyyy.Mdd.Hmm - 1.2023.1027.851 + 1.2023.1113.1443