PDA

View Full Version : caps lock


CIUFFO
30-11-2002, 16:04
Perchè questa sub di access in windows 2000 non funziona correttamente? praticamente non accende il led sulla tastiera.

Sotto windows 98 tutto ok, all'apertura del form imposta automaticamente il tasto caps lock come inserito e il led relativo acceso.

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long
Private Declare Function SetKeyboardState Lib "user32" (lppbKeyState As Byte) As Long

Sub SetCapsLock(ByVal bnewValue As Boolean)
' get current state of all 256 virtual keys
Dim keystat(0 To 255) As Byte
GetKeyboardState keystat(0)
' modify bit 0 of the relevant item, and store back
keystat(vbKeyCapital) = (keystat(vbKeyCapital) And &HFE) Or (bnewValue And 1)
SetKeyboardState keystat(0)
End Sub

Private Sub Form_Open(Cancel As Integer)
SetCapsLock True
End Sub

CIUFFO
01-12-2002, 21:34
aiuto!!