473,700 Members | 3,126 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 10656
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
1540
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 tried to debug the problem but:
0
1902
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
873
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
1551
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 my own message box that asks for reboot - or as i said, simply give my application time to close...
4
1878
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
1891
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
1696
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 it might be nice to have it do a reboot whenever it has an unhandled exception but then again I'm...
0
1451
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
8709
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9058
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8952
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7791
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5894
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4395
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2371
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2018
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.