Solved

Turn Caps Lock on and off

Posted on 1998-09-28
3
271 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

Independent Software Vendors: 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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

695 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