Results 1 to 2 of 2

Thread: How To set Numlock on/off

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Location
    india
    Posts
    10

    How To set Numlock on/off

    hi,
    Can any one help me out to set numlock on/off in VB 6.0 in Win NT/ Window 2000.

    Thx
    PCM

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    VB Code:
    1. Private Declare Function GetKeyboardState Lib "user32" (pbKeyState As Byte) As Long
    2. Private Declare Function SetKeyboardState Lib "user32" (lppbKeyState As Byte) As Long
    3.  
    4. Private Const VK_CAPITAL = &H14
    5. Private Const VK_NUMLOCK = &H90
    6. Private Const VK_SCROLL = &H91
    7.  
    8.  
    9. ReDim KeyboardBuffer(256) As Byte
    10. GetKeyboardState KeyboardBuffer(0)
    11. 'This example show you how to press the Caps Lock button. if you want
    12. 'to press the Num Lock button, Replace all the following 3 'VK_CAPITAL'
    13. 'with 'VK_NUMLOCK' or VK_SCROLL as desired.
    14. If KeyboardBuffer(VK_CAPITAL) And 1 Then
    15. KeyboardBuffer(VK_CAPITAL) = 0
    16. Else
    17. KeyboardBuffer(VK_CAPITAL) = 1
    18. End If
    19. SetKeyboardState KeyboardBuffer(0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width