caps lock 
Author Message
 caps lock

how I can switch on caps lock from my access application

thank in advance

Luca



Sat, 20 Jan 2001 03:00:00 GMT  
 caps lock
Hi Luca,

Try this method.

'*********** Code start **********

Private Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
End Type

Private Declare Function apiGetVersionEx Lib "kernel32" _
         Alias "GetVersionExA" _
         (lpVersionInformation As OSVERSIONINFO) _
         As Long

Private Declare Function apiGetKeyboardState Lib "user32" _
        Alias "GetKeyboardState" _
        (pbKeyState As Byte) _
        As Long

Private Declare Function apiSetKeyboardState Lib "user32" _
        Alias "SetKeyboardState" _
        (lppbKeyState As Byte) _
        As Long

Private Declare Sub sapikeybd_event Lib "user32" _
        Alias "keybd_event" _
         (ByVal bVk As Byte, _
         ByVal bScan As Byte, _
         ByVal dwFlags As Long, _
         ByVal dwExtraInfo As Long) _

Private Const VK_CAPITAL = &H14
Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2
Const VER_PLATFORM_WIN32_NT = 2
Const VER_PLATFORM_WIN32_WIN95 = 1

Function fGetCapsLock() As Boolean
Dim keys(0 To 255) As Byte
Dim I As Integer
    For I = 1 To 10: DoEvents:  Next I
    apiGetKeyboardState keys(0)

    fGetCapsLock = keys(VK_CAPITAL)
End Function

Sub sCapsLockOn()
Dim tOS As OSVERSIONINFO
Dim keys(0 To 255) As Byte
Dim boolNumLock As Boolean

    tOS.dwOSVersionInfoSize = Len(tOS)
    apiGetVersionEx tOS

    With tOS
        If .dwPlatformId = VER_PLATFORM_WIN32_WIN95 Then
            keys(VK_CAPITAL) = 1
            apiSetKeyboardState keys(0)
        ElseIf .dwPlatformId = VER_PLATFORM_WIN32_NT Then
            sapikeybd_event VK_CAPITAL, &H45, KEYEVENTF_EXTENDEDKEY Or 0, 0
                sapikeybd_event VK_CAPITAL, &H45, KEYEVENTF_EXTENDEDKEY _
                                        Or KEYEVENTF_KEYUP, 0
        End If
    End With
End Sub
'*************** code End *************

HTH
--
Dev Ashish (Just my $.001)
---------------
The Access Web ( http://home.att.net/~dashish )
---------------

:how I can switch on caps lock from my access application
:
:thank in advance
:
:Luca
:
:
:



Sat, 20 Jan 2001 03:00:00 GMT  
 caps lock
You might want to read this article from microsoft's kb:

http://support.microsoft.com/support/kb/articles/q101/1/25.asp

you will find all necessary information

Quote:

> how I can switch on caps lock from my access application

> thank in advance

> Luca

--
Stefano Radice
Analyst/Programmer
Eon sas
Tel.    : +39 362 330642



Sat, 20 Jan 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Setting Num Lock and Caps Lock key states

2. GetKeyState for Caps Lock or Num Lock...

3. Caps Lock

4. Toggling the CAPS Lock key...

5. have caps lock make a sound

6. Reversing Cap Lock Typing

7. caps lock always on when filling in forms

8. CAPS Lock

9. Caps lock

10. Setting caps lock

11. Setting "Caps Lock" on run time

12. Caps Lock

 

 
Powered by phpBB® Forum Software