Disable mouse and keyboard
Use BlockInput procedure to lock keyboard and mouse. This procedure with True parameter disables manipulators and with False parameter enables them.
procedure BlockInput(ABlockInput : boolean); stdcall; external 'USER32.DLL'; ... procedure TForm1.Button1Click(Sender: TObject); begin BlockInput(True); Sleep(5000); BlockInput(False); end;