KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to lock a Windows OS from within 4D code
PRODUCT: 4D | VERSION: 15 | PLATFORM: Win
Published On: October 13, 2015

Here is a simple 4D code snippet to lock the screen of a Windows computer:

// lock workstation on Windows
If (Folder separator="\\")
   $cmd:="cmd.exe /c rundll32.exe user32.dll, LockWorkStation"
   LAUNCH EXTERNAL PROCESS($cmd)
End if

This code can be used to secure the machine and force the user to use CTRL+ALT+DEL to unlock it (assuming a password is enabled on the OS).