Reputation: 6996
This is a part of my project, my project basically uses a motion sensor to detect any intrusion. So one of the modules is to lock the PC on detection of an intruder. Is there a way to lock the PC using Visual Basic?
(Because most of the other modules have been programmed in Visual Basic.) I am basically looking for source code that can implement something similar to "Windows button + L".
Upvotes: 1
Views: 1929
Reputation: 28665
A simple way would be:
Set shell = WScript.CreateObject("WScript.Shell")
shell.Run "rundll32 user32.dll,LockWorkStation"
Upvotes: 3