Tags

, , ,

Windows 8.1 comes with start button and user can directly shutdown or restart or hibernate or logout their PC from right click on the start button. But unfortunately lock” PC does not listed there.

“lock” is a very useful command if we wanna leave our PC for a short time while a download is in progress. Today I decided to code for a small application to call “lock” and finished it in 2 minutes. 

This is a very simple task in C#, just code the below lines.

private void Form1_Load(object sender, EventArgs e) { System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.FileName = "cmd.exe"; startInfo.Arguments = "/C rundll32.exe user32.dll,LockWorkStation"; process.StartInfo = startInfo; process.Start(); Application.Exit(); }

Thats all baby, you can download the application from http://sdrv.ms/1b8Jk1c.

Advertisements