Banging my head all morning about this, as seems to be something you cannot do without calling windows api functions.
Have scraped over the internet and come up with this
h Code:
Private Sub Button6_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click SetKeyState(System.Windows.Forms.Keys.CapsLock, True) End Sub Private Declare Auto Function SetKeyboardState Lib "user32.dll" _ (ByVal lppbKeyState As Byte) As Long Private Declare Auto Function GetKeyState Lib "user32.dll" _ (ByVal nVirtKey As Long) As Boolean Private Declare Auto Function GetKeyboardState Lib "user32.dll" _ (ByVal pbKeyState As Byte) As Long Private Sub SetKeyState(ByVal Key As Long, ByVal State As Boolean) Dim Keys(0 To 255) As Byte Call GetKeyboardState(Keys(0)) Keys(Key) = Math.Abs(CInt(State)) Call SetKeyboardState(Keys(0)) End Sub
But it doesn't work and am well out of my depth.
I just want to check if caps lock is pressed and if so turn it off.
Any help would be greatly appreciated.




Reply With Quote