vb.net - Code snippet to lock my PC -


This is part of my project, my project basically uses a motion sensor to detect any intrusion . So a module is locking the PC on detecting an intruder. Is there a way to lock the PC using Visual Basic?

(Because most other modules are programmed in Visual Basic.) I am basically looking for source code which can implement anything like "Windows Button + L".

An easy way would be:

  set shell = WScript.CreateObject ("WScript.Shell") run "Rundll32 user32.dll, LockWorkStation"  

Comments