|
-
Mar 17th, 2006, 08:55 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Shutdown code
Can any one tell me if there is a code for VB to shutdown windows for example,
if i hit start an hit shutdown it shutsdown the computer, if there is a piece of code what is it.
im using VB 2003.net
-
Mar 17th, 2006, 09:01 PM
#2
Hyperactive Member
Re: Shutdown code
Probably not the best, but use the process and issue the command "shutdown -s -t 00".
-
Mar 17th, 2006, 09:08 PM
#3
Re: Shutdown code
You can call Process.Start to execute the command PENNYSTOCK suggests, but it must be done with two parameters:
VB Code:
Process.Start("shutdown", "-s -t 00")
The shutdown.exe commandline program can do much more than that too. You can get help on its parameters either in the Windows help or on the commandline itself. The other option is to use the ExitWindowsEx API. There are plenty of examples on the forum already. Keep in mind that while both these options will work on WinXP they are not available on all Windows versions. I believe that there's another API too but I can't remember the name. Something like "InitiateWindowsShutdown" but not quite.
-
Mar 17th, 2006, 09:12 PM
#4
Hyperactive Member
Re: Shutdown code
There is this too...An API. However, this just shows the shut down dialog screen.
Declare Function SHShutDownDialog Lib "shell32" Alias "#60" (ByVal YourGuess As Int32) As Int32
Then just call
-
Mar 17th, 2006, 09:21 PM
#5
Re: Shutdown code
That other API I mentioned is InitiateSystemShutdown and it is available on Win2003 and WinXP only. ExitWindowsEx is available back to Win95, so it is probably the safest bet if your app is likely to be used on older platforms. I believe that shutdown.exe may only be available from Win2000, but I'm not 100% sure.
-
Mar 18th, 2006, 01:47 AM
#6
Thread Starter
Hyperactive Member
Re: Shutdown code
ty for the feedback ill try ur suggestions
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
|