Solved

Turn Caps Lock on and off

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maze travler 6 55
Writing a parser for java language 4 80
How to convert MFC APP to Win32 APP. 19 81
White board coding practice 3 88
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

832 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