|
-
Apr 9th, 2006, 10:03 AM
#1
Thread Starter
Addicted Member
[02/03] Shutdown
What would be the correct way to shutdown a users computer from my application? Can you provide a way that will work for all versions of windows?
Thanks
Jesse Bunch
www.getbunch.com/
If I have helped you, please rate my posts!
Unless otherwise indicated, I am using the following Products:
Visual Studio .NET 2010
.NET Framework 4.0
-
Apr 9th, 2006, 10:52 AM
#2
Re: [02/03] Shutdown
There is an API function called SH_SHUTDOWN (google "api-guide" for details).
Also see the DOS "shutdown" command (whih you can call using Process.Start("Shutdown...") )
I don't live here any more.
-
Apr 9th, 2006, 11:02 AM
#3
Re: [02/03] Shutdown
If your app is only going to be used on NT-based OSes then starting a shutdown process is quite flexible. If you need support for older Windows versions then go the API route. SHShutDownDialog will display the Windows shutdown dialog. ExitWindowsEx will shutdown the system. There is also the option of the Shutdown class from Mentalis (see my signature) that encapsulates all that stuff and presents you with a simple-to-use interface.
-
Apr 9th, 2006, 11:20 AM
#4
Thread Starter
Addicted Member
Re: [02/03] Shutdown
Thanks for that....but I am a newbie to API Calls....Can anyone provide me with a sample code that I can use in VB.net 2002 to call the ExitWindowsEx Api?
Thanks
Jesse Bunch
www.getbunch.com/
If I have helped you, please rate my posts!
Unless otherwise indicated, I am using the following Products:
Visual Studio .NET 2010
.NET Framework 4.0
-
Apr 9th, 2006, 05:51 PM
#5
Re: [02/03] Shutdown
There are many examples posted on the forum already. A quick search should turn up what you need. Like I said, you can avoid using API calls youself if you use the class provided by Mentalis. They wrap the APIs in a .NET class so they are hidden from you, although you have the source so you can see how they do it.
-
Apr 9th, 2006, 05:55 PM
#6
Hyperactive Member
Re: [02/03] Shutdown
this works for me
'this will shut down the system.
Process.Start("shutdown", "-s -t 00")
-
Apr 9th, 2006, 06:30 PM
#7
Re: [02/03] Shutdown
 Originally Posted by FireKnox101
this works for me
'this will shut down the system.
Process.Start("shutdown", "-s -t 00")
Shutdown.exe exists only in NT-based OSes. Windows Me and earlier do not support it, so if you need to support those operating systems then you need to use APIs.
-
Apr 9th, 2006, 07:25 PM
#8
Hyperactive Member
Re: [02/03] Shutdown
O i didnt know that =), that is good to know ty
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|