• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Shutdown command in VB?

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

azhari

Member
Joined
Aug 12, 2001
Location
Texas
Is there a command in VB that can shutdown the computer completely? Essentially, is there a VB command that simulates the "Shutdown" windows command?

What I need to do is write a piece of code that can be executed by MBM5 to shutdown the computer if the cpu gets too hot. MBM5 recommends a program to do this, but its shareware, and I don't think a program that shuts down a computer should cost anything (yea, I know, I paid for Windows :D ), so I want to write it myself. But I can't find the darn command to shutdown.
 
if you have access to it, your best bet is the MSDN cd's. I used to have a copy of them but lost them, your next best is http://msdn.microsoft.com. I use it all the time. great for loking up those little things you can't find in other places. I dont know it off hand, so I would check those two out. I'll look into it as well and see what I can turn up.
 
Actually I do have the CDs. I'll look and see what I can find. Thanks.
 
azhari said:
Is there a command in VB that can shutdown the computer completely? Essentially, is there a VB command that simulates the "Shutdown" windows command?

What I need to do is write a piece of code that can be executed by MBM5 to shutdown the computer if the cpu gets too hot. MBM5 recommends a program to do this, but its shareware, and I don't think a program that shuts down a computer should cost anything (yea, I know, I paid for Windows :D ), so I want to write it myself. But I can't find the darn command to shutdown.

if you get SHDN from the mbm hompage it does that. It doesn't cost anything. Not shutdown now.

mainpage here then goto extentions and scroll down to SHUTDOWN, right before shutdown now. Just download(small download just one file) that and put it in the mbm5 folder and got to your alarms and tell them to start that program.
 
I don't remember how to do this exactly but you can call win32 api functions from VB. Call ExitWindowsEx(EWX_POWEROFF, 0); or ExitWindowsEx(EWX_POWEROFF | EWX_FORCE, 0); to shutdown the machine (those are the C style calls, not VB...)
 
Private Const EWX_SHUTDOWN As Long = 1

Private Declare Function ExitWindowsEx Lib "user32" (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long


Declare LnR As Long

LnR = ExitWindowsEx(EWX_SHUTDOWN, 0&)
 
Back