Qbasicnews.com

Full Version: Caps Lock
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Has anybody got any code to make sure the caps lock is on
This is the best i can offer, i'm not sure if theres a better way. Windows only aswell.

Code:
#include "windows.bi"

Option Explicit

While Inkey$ <> Chr(27)
  Locate 1, 1
  If GetKeyState(VK_CAPITAL) <> 0 Then
    Print "CAPS LOCK - ON "
  Else
    Print "CAPS LOCK - OFF"
  End If
  Sleep 100
Wend
You can make sure that CAPS LOCK is on,
but that won't prevent the user from turning it OFF just when you thought it was ON.

The same applies for the NUM LOCK.
*****