Lock Windows 8 and 8.1 from start screen

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s