Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do I reboot the pc?

Status
Not open for further replies.

PZ

Programmer
Jul 21, 2000
18
0
0
IT
In VB is there a way to reboot the pc with a code line or a statment?

Thanx in advance! [sig]<p> Alex<br><a href=mailto:pizzapz@libero.it>pizzapz@libero.it</a><br><a href= > </a><br>*** Q(uick)BASIC RULEZ! :D***[/sig]
 
There is a FAQ for rebooting NT here. [sig][/sig]
 
Add the following API Declares and Constants to
a BAS Module:

Declare Function ExitWindowsEx& Lib &quot;user32&quot; (ByVal uFlags&, ByVal
wReserved&)

Global Const EWX_FORCE = 4 'constants needed for exiting Windows
Global Const EWX_LOGOFF = 0
Global Const EWX_REBOOT = 2
Global Const EWX_SHUTDOWN = 1

Then you Shutdown/reboot/logoff windows with the following call:

lresult = ExitWindowsEx(EWX_SHUTDOWN, 0&) 'shut down the computer

Note: Replace the first parameter of the ExitWindowsEx function call
with the appropriate CONSTANT.
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top