Today I'll show you how to make a simple shutdown utility using visual basic 2010.
If you are a new comer and you do not have Visual Basic, you can download microsoft visual basic express edition from the below link. Click on the link and then wait for 5 seconds and then click on "SKIP AD" and your download will start automatically.
Download Visual Basic
THE DESIGNING PART:
At First, open Visual Basic and Click on New Project. Select Visual Basic from the left panel and select Windows Forms Application from the right side. Change the project name to Shut Down Utility. Something like this picture:
Do like this:
Again change the Button1's text property to "Click me to Shutdown your pc", Button2's to "Click me to restart your pc" and Button3's to "Click me to log off your pc". Do something like this:
THE CODING PART:
Here comes the fun part. Now we will add code so that our program work properly.
Now double click on the button which is renamed to "Click me to shutdown your pc" that means the first button.
Then you will see something like this:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
End Class
Now add this red color highlighted code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Shell("shutdown -s")
End Sub
End Class
Then double click on "Click me to restart your pc" button and add the following red color highlighted code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Shell("shutdown -r")
End Sub
Now again double click on "Click me to log off your pc" button and add the red color highlighted code:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Shell("shutdown -l")
End Sub
Now debug and run the application. It will work fine. But when you start debugging, your computer may automatically shutdown. So, save before you run.