Results 1 to 9 of 9

Thread: num-lock

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    chicago (hope)
    Posts
    146

    num-lock

    is there a registry entry or similar, that says windows to turn numlock on/off, when logging on????
    i have a win2000 pro, and when i login as admin, numlock is on.... but when i login as another user, numlock is off... but it should be on.........

    if there is no setting, how to activate numlock from code (vb...)??? then i'll write a autorun app....

    thanx

  2. #2
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Here is code you can use to turn it on or off
    VB Code:
    1. Private Declare Function GetKeyboardState& Lib "user32" (pbKeyState As Byte)
    2. Private Declare Function SetKeyboardState& Lib "user32" (lppbKeyState As Byte)
    3. Dim keystate(256) As Byte
    4.  
    5. Private Sub TurnOnNumlock()
    6. Call GetKeyboardState(keystate(0))
    7. keystate(vbKeyNumlock) = keystate(vbKeyNumlock) Or 1
    8. Call SetKeyboardState(keystate(0))
    9. End Sub
    10.  
    11. Private Sub TurnOffNumlock()
    12. Call GetKeyboardState(keystate(0))
    13. keystate(vbKeyNumlock) = keystate(vbKeyNumlock) And &HFFFE
    14. Call SetKeyboardState(keystate(0))
    15. End Sub
    16.  
    17. Private Sub Command1_Click()
    18. Call TurnOnNumlock
    19. End Sub
    20.  
    21. Private Sub Command2_Click()
    22. Call TurnOffNumlock
    23. End Sub
    What I find curious, however, is the fact that you would need this. I don't believe I've ever encountered any machine, running any OS, that didn't have numlock set to on at boot time.

  4. #4
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Beat ya by 2 minutes Hack

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Yeah, I know. I don't type all that fast on Sunday mornings I guess.

  6. #6
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Saturday night here

  7. #7
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    The registry entry HKEY_CURRENT_USER\Control Panel\Keyboard\InitialKeyboardIndicators can be used to set the initial state of the Num Lock key for the current user.
    To modify the num lock state for all users use HKEY_USERS\.DEFAULT\Control Panel\Keyboard\InitialKeyboardIndicators.
    The value for InitialKeyboardIndicators should be set to 2.

    An other way to keep the state of the Num Lock key is to always log off using the Ctrl+Alt+Del security dialog box.

    Best regards

  8. #8
    Member FrogBoy666's Avatar
    Join Date
    Aug 2000
    Location
    Columbia, SC
    Posts
    34

    Unhappy Actually...

    In response to Hack's comment:
    What I find curious, however, is the fact that you would need this. I don't believe I've ever encountered any machine, running any OS, that didn't have numlock set to on at boot time
    What about laptops?

    I have used several different models (in fact, I'm using one now), and every one that I used had Num Lock set to "off" because the number pad is integrated with the rest of the keys. For instance, on the laptop I'm using now, when you hold down the "Fn" key the "number pad" keys are set up as follows:

    M = 0
    . = .
    ? = /
    J = 1
    K = 2
    L = 3
    ; = +
    U = 4
    I = 5
    O = 6
    P = -
    7 = 7
    8 = 8
    9 = 9
    0 = *

    Never say never... they always find a way to make things incompatible.

  9. #9
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    You make a good point FrogBoy. I had not considered Laptops.

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