Hello
Does anyone know how can I get the status of Caps Lock; Num Loc;k Srcoll lock?
using access 2007.
Regards,
Does anyone know how can I get the status of Caps Lock; Num Loc;k Srcoll lock?
using access 2007.
Regards,
'Code from "VBA Developer's Handbook" (Sybex, 1997): Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) _ As Integer
Function GetCapslock() As Boolean 'Return the CapsLock Value GetCapslock = CBool(GetKeyState(vbKeyCapital) And 1) End Function
Function GetNumlock() As Boolean 'Return the NumLock Value GetNumlock = CBool(GetKeyState(vbKeyNumlock) And 1) End Function
Public Function GetScrollLock() As Boolean 'Return the ScrollLock Value GetScrollLock = CBool(GetKeyState(&H91) And 1) End Function
If GetCapslock() Then MsgBox "Caps Lock is ON!" Else MsgBox "Caps Lock is OFF!" End If If GetNumlock() Then MsgBox "Num Lock is ON!" Else MsgBox "Num Lock is OFF!" End If If GetScrollLock() Then MsgBox "Scroll Lock is ON!" Else MsgBox "Scroll Lock is OFF!" End If
'Code from "VBA Developer's Handbook" (Sybex, 1997): Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) _ As Integer
Function GetCapslock() As Boolean 'Return the CapsLock Value GetCapslock = CBool(GetKeyState(vbKeyCapital) And 1) End Function
Function GetNumlock() As Boolean 'Return the NumLock Value GetNumlock = CBool(GetKeyState(vbKeyNumlock) And 1) End Function
Public Function GetScrollLock() As Boolean 'Return the ScrollLock Value GetScrollLock = CBool(GetKeyState(&H91) And 1) End Function
If GetCapslock() Then MsgBox "Caps Lock is ON!" Else MsgBox "Caps Lock is OFF!" End If If GetNumlock() Then MsgBox "Num Lock is ON!" Else MsgBox "Num Lock is OFF!" End If If GetScrollLock() Then MsgBox "Scroll Lock is ON!" Else MsgBox "Scroll Lock is OFF!" End If
Comment