Thursday 29 December 2011

Shut down or Restart Windows using Visual Basic 6

Hi friends now I am discuss about restart or shut down windows XP or higher versions using Visual Basic 6.
Usually we use start menu then the shutdown button to  shut down.
But we can use the shell functions in VB 6 to shut down windows.

It is a single step statement:

Shell ("shutdown.exe -s -t 00")

Where shell() is the library function.
shell have three parameters,
shutdown.exe is a system program run on windows

-s specify the operation to be executed such as shut down/restart.
-s for Shut down,-r for Restart and -l for Log off.

The third parameter -t 00 specifies the time delay taken before the operation execute.
-t 00 specifies wait for 0 seconds,where -t 30 means wait 30 seconds before shut down.

  The scope of this function is very large.
For instance, we can make a vb form in which the shell function  Shell ("shutdown.exe -s -t 00")
is added in the form load event.Then make the project.exe.Then made a short cut icon to this .exe
file in desktop.In short cut icons properties set it's short cut keys to 'ctrl+alt+s'.Then press
these keys the computer will shut down in no time without asking anything.You can use this application to
shut down computer when you have no time to click start->Turn off computer->Turn off.

Hope that this post is helpful to you.
By Sukesh B R

No comments:

Post a Comment

Search This Blog