PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
VB6-Capturing Caps Lock, Scroll Lock, Num Lock and Insert Key Status-VBForums
Results 1 to 9 of 9

Thread: VB6-Capturing Caps Lock, Scroll Lock, Num Lock and Insert Key Status

Hybrid View

  1. #1

    Thread Starter
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    VB6-Capturing Caps Lock, Scroll Lock, Num Lock and Insert Key Status

    VB Code:
    1. 'Include this line in your General Declaration of a Form
    2. Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
    3. 'Add a command button to your form and paste this code into it
    4. Private Sub Command1_Click()
    5.     If GetKeyState(vbKeyCapital) = 0 Then
    6.         MsgBox "Capital OFF"
    7.     Else
    8.         MsgBox "Capital ON"
    9.     End If
    10.     If GetKeyState(vbKeyNumlock) = 0 Then
    11.         MsgBox "NumLock OFF"
    12.     Else
    13.         MsgBox "NumLock ON"
    14.     End If
    15.     If GetKeyState(vbKeyInsert) = 0 Then
    16.         MsgBox "Insert OFF"
    17.     Else
    18.         MsgBox "Insert ON"
    19.     End If
    20.     If GetKeyState(vbKeyScrollLock) = 0 Then
    21.         MsgBox "Scroll Lock OFF"
    22.     Else
    23.         MsgBox "Scroll Lock ON"
    24.     End If
    25. End Sub
    A sample project with this code and a timer to update the key status in the labels, attached in zip file format.
    Attached Files Attached Files
    Last edited by ganeshmoorthy; Dec 5th, 2006 at 05:46 AM. Reason: Edit: Sample project attached
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  2. #2

    Thread Starter
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: VB6-Capturing Caps Lock, Scroll Lock, Num Lock and Insert Key Status

    Im open to any comments....
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  3. #3
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: VB6-Capturing Caps Lock, Scroll Lock, Num Lock and Insert Key Status

    Nice Code Ganesh

  4. #4

    Thread Starter
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: VB6-Capturing Caps Lock, Scroll Lock, Num Lock and Insert Key Status

    Thanks Shakti
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  5. #5

    Thread Starter
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: VB6-Capturing Caps Lock, Scroll Lock, Num Lock and Insert Key Status

    any suggestions...
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  6. #6

    Thread Starter
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: VB6-Capturing Caps Lock, Scroll Lock, Num Lock and Insert Key Status

    guys please give me your comments...
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  7. #7
    Junior Member
    Join Date
    Jan 2007
    Location
    england
    Posts
    27

    Re: VB6-Capturing Caps Lock, Scroll Lock, Num Lock and Insert Key Status

    i found this gd but i made a few adjustments to it instead of having them as msgboxs i put them into a listbox then modified it so instead of it multiplying the values everytime you click on the button, it wipes the previous values and then calls the command again.

    VB Code:
    1. Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
    2.  
    3.  
    4. Private Sub cmd_state_Click()
    5.  
    6. If List_state.ListCount = 0 Then
    7.  
    8.     If GetKeyState(vbKeyCapital) = 0 Then
    9.         List_state.AddItem "Capital OFF"
    10.     Else
    11.         List_state.AddItem "Capital ON"
    12.     End If
    13.    
    14.     If GetKeyState(vbKeyNumlock) = 0 Then
    15.         List_state.AddItem "NumLock OFF"
    16.     Else
    17.         List_state.AddItem "NumLock ON"
    18.     End If
    19.    
    20.     If GetKeyState(vbKeyInsert) = 0 Then
    21.         List_state.AddItem "Insert OFF"
    22.     Else
    23.         List_state.AddItem "Insert ON"
    24.     End If
    25.    
    26.     If GetKeyState(vbKeyScrollLock) = 0 Then
    27.         List_state.AddItem "Scroll Lock OFF"
    28.     Else
    29.         List_state.AddItem "Scroll Lock ON"
    30.     End If
    31.    
    32. Else:
    33. List_state.Clear
    34. Call cmd_state_Click
    35.  
    36. End If
    37.  
    38. End Sub
    dont believe in all that you've been told!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  8. #8

    Thread Starter
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: VB6-Capturing Caps Lock, Scroll Lock, Num Lock and Insert Key Status

    thank you very much for your suggestion...but instead of the listbox, we can update label caption for these key status...will incorporate that...but have you checked the attached zip file?
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  9. #9
    Junior Member
    Join Date
    Jan 2007
    Location
    england
    Posts
    27

    Re: VB6-Capturing Caps Lock, Scroll Lock, Num Lock and Insert Key Status

    hey, this was really good when i found it, it seemed cool, and the other week when i got bored i found the file, and developed on it so much, there is a splash screen at the begging letting you change loads of settings and the form that tells you about the states sits in the top right corner and it aslo sits on top of all other programs or windows you have open, good if your writing in a text editor and dont want to look down at the keyboard to check the states.

    i would upload the files and the exe but as i havent uploaded onto this site before,i dont know , could some one message me and tell me how and ill put it up in a new thread. i just thought someone might wanna make use of the code. i will also refer back to this thread in the new one.

    msg please

    will
    dont believe in all that you've been told!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width