943,015 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 143
  • C++ RSS
Sep 2nd, 2010
0

Sensing The Caps Lock Key

Expand Post »
I'd like to know what the ASCII codes for the toggle keys of the keyboard. I want to make the mouse clicks do different thing when the Caps Lock, or Scroll Lock is pressed.

Walt
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
walter clark is offline Offline
40 posts
since Jun 2009
Sep 2nd, 2010
0
Re: Sensing The Caps Lock Key
Here's a thread with a similar question. Perhaps the link(s) there will help?
Featured Poster
Reputation Points: 833
Solved Threads: 392
Posting Maven
Fbody is offline Offline
2,846 posts
since Oct 2009
Sep 2nd, 2010
0
Re: Sensing The Caps Lock Key
win32 api function GetKeyState()
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5591
Solved Threads: 2280
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,932 posts
since Aug 2005
Sep 2nd, 2010
0
Re: Sensing The Caps Lock Key
Thanks Ancient Dragon for the lead.
I studied it and found it needed both
#include "windows.h" and
#include "winuser.h" in the .cpp file that has the call.
But I get the dreaded linker error LNK2001; unresolved external symbol.
Do you have experience with that error?

Thanks
Reputation Points: 10
Solved Threads: 0
Light Poster
walter clark is offline Offline
40 posts
since Jun 2009
Sep 2nd, 2010
0
Re: Sensing The Caps Lock Key
Look at that link I gave you, scroll down the page and it will tell you what libraries you need.

You don't have to include winuser.h when you include windows.h
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5591
Solved Threads: 2280
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,932 posts
since Aug 2005
Sep 2nd, 2010
0
Re: Sensing The Caps Lock Key
Wow, THAT DID IT.
THANK YOU SO MUCH Ancient Dragon.

For anyone as beginner as I am, the .lib is loaded in Visual Studio by way of the Project tab. In there choose the last option xxx Properties Alt+F7.
Then click on the + of Configuration Properties, then the + of Linker and then Command Line. And at the bottom is Additional options: In huge space type User32.lib
Reputation Points: 10
Solved Threads: 0
Light Poster
walter clark is offline Offline
40 posts
since Jun 2009
Sep 2nd, 2010
0
Re: Sensing The Caps Lock Key
you can also just use the pragma, located near the beginning of the *.cpp file, after the includes
#pragma comment(lib,"user32.lib")
Last edited by Ancient Dragon; Sep 2nd, 2010 at 3:27 pm.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5591
Solved Threads: 2280
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,932 posts
since Aug 2005

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: characters should appear on mouse focus :(
Next Thread in C++ Forum Timeline: RAM memory consumption





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC