Skip to main content

Detecting Caps Lock and other Function Keys in WinForm

  • August 6, 2019
  • 2 replies
  • 0 views

Alexander Castro

Is there a command to detect whether the Caps lock, Num lock, or the Insert key are on in managed COBOL? The command in C# is something like:

 

if (Control.IsKeyLocked(Keys.CapsLock))

    do something

end if.

 

The following command in managed COBOL only detect whether the keys were pressed but does not detect whether the caps lock is on:

 

if e::KeyCode = type Keys::CapsLock

    do something

end-if.

2 replies

Chris Glazier
Forum|alt.badge.img+2

Is there a command to detect whether the Caps lock, Num lock, or the Insert key are on in managed COBOL? The command in C# is something like:

 

if (Control.IsKeyLocked(Keys.CapsLock))

    do something

end if.

 

The following command in managed COBOL only detect whether the keys were pressed but does not detect whether the caps lock is on:

 

if e::KeyCode = type Keys::CapsLock

    do something

end-if.

You can check this using the same syntax as the C# snippet

if type Control::IsKeyLocked(type Keys::CapsLock) display "caps on" else display "caps off" end-if

Alexander Castro
  • Author
  • Participating Frequently
  • August 7, 2019

You can check this using the same syntax as the C# snippet

if type Control::IsKeyLocked(type Keys::CapsLock) display "caps on" else display "caps off" end-if
That worked, thank you!