?
Solved

Turn Caps Lock on and off

Posted on 1998-09-28
3
Medium Priority
?
274 Views
Last Modified: 2012-06-27
Hello!

I wonder if it is possible to force the keys Caps lock,Num lock, or Scroll lock to be on or off at a certain time in my aplication.

How do I do?

mrc
0
Comment
Question by:mrc121197
[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
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
Answers2000 earned 0 total points
ID: 1173916
BYTE abyKeys[256] ;

::GetKeyboardState( abyKeys ) ;

abyKeys[ VK_whatever ] |= 1 ; // set toggle key on
abyKeys[ VK_whatever ] &= ~1 ; // set toggle key off

::SetKeyboardState( abyKeys ) ;

Docs are in GetKeyboardState API

0
 
LVL 22

Expert Comment

by:nietod
ID: 1173917
Note that this technique does not affect the indicator lights on the keyboard and will not affect the caps lock etc status of other programs.

You can use keybd_event() to send "fake" key strokes to affect the indicator lights and to affect other processes.
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1173918
Good point
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

764 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