Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to get Caps and Num Lock information on statusbar in vb.net

Posted on 2004-04-12
5
Medium Priority
?
601 Views
Last Modified: 2011-10-03
i am using statusbar control in vb.net
and i have made two panels on that and i want that whenever i run this application and at that time if users do caps on/ off or num lock on/off then it appears in my status bar
how can i do it.
0
Comment
Question by:deepakyadav
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
mahanatti earned 500 total points
ID: 10810814
Try this for Caps Lock...

within your class declare the method GetKeyState and two constans as velow

Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Integer) As Integer

  Const VK_NUMLOCK = 144
  Const VK_CAPLOCK = 20

Where required use this code to call the function

Dim capslocki = GetKeyState(&H14)
   If capslocki Then
      MsgBox("CapsLock On")
   End If

-Maha.
0
 
LVL 2

Expert Comment

by:mahanatti
ID: 10810855
To get the NumLock info

Dim numlocki = GetKeyState(&H90)
    If numlocki Then
      MsgBox("NumLock On")
    End If

-Maha.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Screencast - Getting to Know the Pipeline

927 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