hello everyone,<br><br>how do i switch numlock on when loading a form in access<br>my idea is such as "set numlock is true"but it ain't working <br>does anyone know how this is done<br><br>thanks for any help
The following API function will do what you want. It can also be used for the Cap Locks with a few changes that are documented in the code:<br><br>'*********************************************<br>'Windows API/Global Declarations for :NumLock<br>'*********************************************<br><br>'Public Const VK_CAPLOCK = &H14<br>Public Const VK_NUMLOCK = &H90<br><br>Public Type KeyboardBytes<br>kbByte(0 To 255) As Byte<br>End Type<br>Public kbArray As KeyboardBytes<br> <br>Public Declare Function GetKeyState Lib "user32" _<br>(ByVal nVirtKey As Long) As Long<br>Public Declare Function GetKeyboardState Lib "user32" _<br>(kbArray As KeyboardBytes) As Long<br>Public Declare Function SetKeyboardState Lib "user32" _<br>(kbArray As KeyboardBytes) As Long<br><br>'********************************************<br>'Add the following code to the form<br>'to change to CapLocks change VK_NUMLOCK to VK_CAPLOCK<br>'********************************************<br>Private Function NumLock() As Integer<br> NumLock = GetKeyState(VK_NUMLOCK) And 1 = 1<br>End Function<br><br>Private Sub Form_Load()<br>GetKeyboardState kbArray<br>kbArray.kbByte(VK_NUMLOCK) = 1<br>SetKeyboardState kbArray<br>End Sub<br><br>HTH<br>RDH <p>Ricky Hicks<br><a href=mailto: rdhicks@mindspring.com> rdhicks@mindspring.com</a><br><a href= > </a><br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.