Scalabium Software

SMExport advertising
Knowledge for your independence'.
Home Delphi and C++Builder tips


#101: How can I switch in run-time the state of NumLock, CapsLock, ScrollLock keys?

In the development of some programs you needs to switch a state of NumLock, CapsLock or ScrollLock in run-time. For example, you can flash these keys for showing of current status of your program (notification about new message or succesful file downloading) or use the lamps of these keys with melody playback:))

The solution is easy - view a source:

var
  KeyState: TKeyboardState;
begin
  {read a current state of keys}
  GetKeyboardState(KeyState);

  {swich a CapsLock key}
  KeyState[020] := KeyState[020] xor 1;

  {swich a NumLock key}
  KeyState[144] := KS[144] xor 1; //Num Lock

  {swich a ScrollLock key}
  KeyState[145] := KeyState[145] xor 1; //Scroll Lock

  {set a modified states}
  SetKeyboardState(KeyState);
end;

For example, you can call this code in some cycle. For some task is very useful.


Published: October 12, 2000

See also
 
DBExport tools
DBISAM Password Recovery
ABA Picture Convert
SMExport suite
MAPIMail
Paradox to MS Access converter
Viewer for MS Outlook Messages
ABA Document Convert
ABA Spreadsheet Convert
Word Web-stream
 
 


Contact to webmaster

 

Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2024, Scalabium Software. All rights reserved.
webmaster@scalabium.com

SMExport advertising