473,574 Members | 2,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reboot and Shutdown Windows XP using VB.NEt

Hi,

I would like to know the code for reboot and shutdown windows xp
professional using VB.Net.

thanx

Senthil
Nov 22 '05 #1
3 10647
Try shelling the windows shutdown process.
Example:

'--------------------------------------
' Shelling shutdown process
Shell("shutdown .exe -s")
'--------------------------------------
Usage:
shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c
"comment"]
[-d up:xx:yy]

-i Display GUI interface, must be the first
option
-l Log off (cannot be used with -m option)
-s Shutdown the computer
-r Shutdown and restart the computer
-a Abort a system shutdown
-m \\computername Remote computer to shutdown/restart/abort
-t xx Set timeout for shutdown to xx seconds
-c "comment" Shutdown comment (maximum of 127 characters)
-f Forces running applications to close without
warning
-d [u][p]:xx:yy The reason code for the shutdown
u is the user code
p is a planned shutdown code
xx is the major reason code (positive
integer less than 256)
yy is the minor reason code (positive
integer less than 65536)

"Senthil" wrote:
Hi,

I would like to know the code for reboot and shutdown windows xp
professional using VB.Net.

thanx

Senthil

Nov 22 '05 #2
Shell the windows shutdown process:

Shell("shutdown .exe -s")

------------------------------------
Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx]
[-c "comment"] [-d up:xx:yy]

-i Display GUI interface, must be the first
option
-l Log off (cannot be used with -m option)
-s Shutdown the computer
-r Shutdown and restart the computer
-a Abort a system shutdown
-m \\computername Remote computer to shutdown/restart/abort
-t xx Set timeout for shutdown to xx seconds
-c "comment" Shutdown comment (maximum of 127 characters)
-f Forces running applications to close without
warning
-d [u][p]:xx:yy The reason code for the shutdown
u is the user code
p is a planned shutdown code
xx is the major reason code (positive
integer less than 256)
yy is the minor reason code (positive
integer less than 65536)
------------------------------------

"Senthil" wrote:
Hi,

I would like to know the code for reboot and shutdown windows xp
professional using VB.Net.

thanx

Senthil

Nov 22 '05 #3
Elp
On Sat, 8 Jan 2005 07:33:02 -0800, Senthil wrote:
I would like to know the code for reboot and shutdown windows xp
professional using VB.Net.


The most reliable way would be to use the ExitWindowsEx API via Interop
with the appropriate parameters. You can find all the needed interop
declarations in this library: http://www.mentalis.org/soft/class.qpx?id=7
Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1534
by: Guillaume Senneville | last post by:
hi, we are having this weird problem that can be reproduced easily on 2 out of 2 servers where we've tried: - we run a SQL Server 2000 stored procedure that processes 2.5 million rows (big procedure with many cursors) - when it hits an area of procedure (not always the exact same place, but in the same area) , the server reboots I've...
0
1894
by: Allan Bredahl | last post by:
Hi All I am trying to construct an application that is able to cancel a machine shutdown, reboot or logoff. And after performing some stuff to perform the original shutdown order : Shutdown/reboot/logoff. I have tried this : AddHandler Microsoft.Win32.SystemEvents.SessionEnding, AddressOf
0
865
by: Sen | last post by:
Hi, I would like to know the code for reboot and shutdown the Windows XP Proffessional System. Thanx Senthil
3
1189
by: Senthil | last post by:
Hi, I would like to know the code for reboot and shutdown windows xp professional using VB.Net. thanx Senthil
1
1547
by: Haim | last post by:
Anybody knows how to prevent a shutdown command? (on Win XP). Or just a way to let my application close itself rather then being killed by the restart command. I have been working in my organization on an application that sometimes gets killed by an installation that restarts the computer. I want to prevent this from happening and display...
4
1871
by: Urs Vogel | last post by:
Hi I deploy a Windows Service which requires a reboot after setup. The setup project, however, does not automatically recognize this requirement.How do I force a reboot (or set a reboot property) in the setup project (VS 2003)? Any hints are appreciated. Thanks, Urs
3
2220
by: sam | last post by:
I found reboot script at TechNet and I wonder how to apply in VB.Net? Reboot Coding ************ strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate,(Shutdown)}!\\" & _ strComputer & "\root\cimv2") Set colOperatingSystems = objWMIService.ExecQuery _ ("SELECT * FROM Win32_OperatingSystem")
18
1877
by: Lee Kok Onn | last post by:
Hi, I have written the following code in vb2005 to reboot the windows, but end with error "ExitWindows(EWX_REBOOT, &HFFFFFFFF)", call to PInvoke function 'shutdown!shutdown.Form1::ExitWindows' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature"
3
1691
by: cj | last post by:
My program shuts itself down and reboots the pc it's running on at 2:00am twice a week and has been doing so without fail for over a year. But twice in the past month it's been found running in the AM with an unhandled exception on the screen. As best I can tell this exception occurs while it's trying to reboot the pc. This has me thinking...
0
1439
by: remya1000 | last post by:
i'm using VB.NET. i wrote a Auto Reboot program. and here is the codes i tried... Code: Private Enum ShutDown1 LogOff = 0 Shutdown = 1 Reboot = 2 ForcedLogOff = 4
0
7741
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8126
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5637
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5328
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3763
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3781
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2257
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1090
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.