Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to Toggle Caps Lock, Scroll Lock and Num Lock?

Posted on 2001-09-11
5
Medium Priority
?
501 Views
Last Modified: 2012-05-04
Dear Friends,
    My VB Applications form contains Billingual fonts for support to local Language. Whenever Focus moves to that text (Which is meant to show text in local format and keyborad also be set to local lang support ). To achive this I have to press Eithrt Num/Scroll/Caps Key. But Instead I want my application to do this.
    I think I need to call some API's. Anyone who knows please reply.
    Thanks,
               bhatul
0
Comment
Question by:bhatul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Accepted Solution

by:
jtjcomp earned 400 total points
ID: 6475124
This code cycles through the three buttons

Private Declare Function SetKeyboardState Lib "user32" (lppbKeyState As Byte) As Long
Private Const VK_NUMLOCK = &H90
Private Const VK_SCROLL = &H91
Private Const VK_CAPITAL = &H14

Dim State As Long
Dim ted(0 To 255) As Byte


Private Sub Command1_Click()
    Timer1.Interval = 500
End Sub


Private Sub Form_Load()
    State = 1
End Sub

Private Sub Timer1_Timer()
    Select Case State
        Case 1
            'this sets it on
            ted(VK_NUMLOCK) = 1
            SetKeyboardState ted(0)
            ted(VK_CAPITAL) = 0
            SetKeyboardState ted(0)
            ted(VK_SCROLL) = 0
            SetKeyboardState ted(0)
        Case 2
            ted(VK_NUMLOCK) = 0
            SetKeyboardState ted(0)
            ted(VK_CAPITAL) = 1
            SetKeyboardState ted(0)
            ted(VK_SCROLL) = 0
            SetKeyboardState ted(0)
        Case 3
            ted(VK_NUMLOCK) = 0
            SetKeyboardState ted(0)
            ted(VK_CAPITAL) = 0
            SetKeyboardState ted(0)
            ted(VK_SCROLL) = 1
            SetKeyboardState ted(0)
    End Select
   
    If State = 3 Then
        State = 1
    Else
        State = State + 1
    End If
   
   
   

End Sub
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6478206
Hi bhatul,

Some interesting link here:

Activating CapsLock, NumLock, ScrollLock and PrintScreen on NT/2000: http://www.mvps.org/vbnet/code/system/capslocknt.htm

Activating CapsLock and NumLock on Win9x: http://www.mvps.org/vbnet/code/system/capslock.htm

'Hope will help.
0
 
LVL 2

Expert Comment

by:Lunchy
ID: 6478462
bhatul, it is to your advantage to reject an answer immediately if it does not completely satisfy your requirements.

Lunchy
Friendly Neighbourhood Community Support Moderator
0
 
LVL 15

Expert Comment

by:ameba
ID: 6478933
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question