954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Detecting any key being pressed.

Hey all,

Is there a way that I can detect when any key has been pressed?

Basically I have a login box and if the user has Caps Lock on and tries to enter his password a Tooltip apears, however as soon as they type again I want the tool tip to disappear. Is there away i can detect the user has hit a key??

Thanks

mstester
Newbie Poster
17 posts since Aug 2006
Reputation Points: 10
Solved Threads: 0
 

Yes, I think so. Although because caps lock is considered an oddity you might only be able to access it from a lower level api call. So it is a lot more work.

http://www.a1vbcode.com/snippet-3541.asp

Perhaps and:-

http://blogs.msdn.com/michkap/archive/2006/03/29/562606.aspx

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

yes you can do it in the forms keypress event. Are you working with windows application or console applications. if its windows then u can fine Forms-> KeyPress Event or search it in msdn library

arjunsasidharan
Practically a Posting Shark
826 posts since Aug 2006
Reputation Points: 347
Solved Threads: 13
 

If your using .NET 3.5 you won't have to worry about the Caps lock being on as a warning is shown automatically for you! (I think this will only work if you have set the UseSystemPasswordChar attribute to True, this will only take effect after your project has been published i.e: not in design/run time).

KillerOfDN
Junior Poster in Training
51 posts since Apr 2008
Reputation Points: 3
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You