Q:  How do I disable and enable the keyboard ?

A:  Here is a DLL to do it:

Library KillKB;

Uses Wintypes, WinProcs
{$IFNDEF VER80}
  ,Win31
{$ENDIF}
  ;
Var
  oldHook: HHook;

Function KbHook( code: Integer; wparam: Word; lparam: LongInt ): LongInt;
  export;
Begin
  If code < 0 Then
    KbHook := CallNextHookEx( oldHook, code, wparam, lparam )
  Else
    KbHook := 1;
End; { KbHook }

Function DisableKeyboard: Boolean; export;
Begin
  oldHook := SetWindowsHookEx( WH_KEYBOARD, KbHook, HInstance, 0 );
  DisableKeyboard := oldHook <> 0;
End;

Procedure EnableKeyboard; export;
Begin
  If oldHook <> 0 Then Begin
    UnhookWindowshookEx( oldHook );
    oldHook := 0;
  End; { If }
End;

exports
DisableKeyboard index 1,
EnableKeyboard index 2;

Begin
  oldHook := 0;
End.
 

Note:  There are a few key combinations that are not passed on to apps at all so they cannot be trapped by a hook. Ctrl-Alt-Del may be one of them but I'm not sure. Just try to see if you can get the blue screen when you have disabled the keyboard via the DLL. Other dubious candiates are Alt-Tab and Ctrl-Esc.