473,385 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Programmatically Restart Computer/Application

Hi all,

Is there a way to programmatically restart Windows (2000, specifically),
login automatically then start an application? I've been running across
some Windows Shell options (which further examples would be appreciated) but
would particularly like to find a .NET-specific example.

TIA,

John
Nov 15 '05 #1
2 3427
John,

To restart the computer, you can use the ExitWindowsEx API function,
which you can call through the P/Invoke layer.

To automatically log in and start an application, well, that's not such
a good idea. You might want to consider just running a service.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"John Spiegel" <js******@YETANOTHERSPAMHATERc-comld.com> wrote in message
news:eD**************@TK2MSFTNGP09.phx.gbl...
Hi all,

Is there a way to programmatically restart Windows (2000, specifically),
login automatically then start an application? I've been running across
some Windows Shell options (which further examples would be appreciated) but would particularly like to find a .NET-specific example.

TIA,

John

Nov 15 '05 #2
Hi Nicholas,

Thanks for the info!

The program I'm trying to kick off is not .NET-based and cautions against
running as a service. I do agree that it's generally poor form to
automatically do what I'm looking to, um, automatically do. In this case,
we have a single machine that suffers from memory leaks when it runs this
other app and we'd like to be able to let it reboot and start back up w/o
intervention--especially to take advantage of the overnight processing time.
It seems to me (though I'm pretty new to .NET and OS APIs) that not running
as a service would lead me back to setting the app to run in the start up
for the user and log them back in.

Thanks,

John

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eq**************@tk2msftngp13.phx.gbl...
John,

To restart the computer, you can use the ExitWindowsEx API function,
which you can call through the P/Invoke layer.

To automatically log in and start an application, well, that's not such a good idea. You might want to consider just running a service.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"John Spiegel" <js******@YETANOTHERSPAMHATERc-comld.com> wrote in message
news:eD**************@TK2MSFTNGP09.phx.gbl...
Hi all,

Is there a way to programmatically restart Windows (2000, specifically),
login automatically then start an application? I've been running across
some Windows Shell options (which further examples would be appreciated)

but
would particularly like to find a .NET-specific example.

TIA,

John


Nov 15 '05 #3

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

Similar topics

7
by: JonBoy | last post by:
Is it possible to put the logoff/shutdown/restart buttons on an ASP page or something similar? If so can anyone point me in the direction of some code please or where I can read how to do it ...
4
by: Keith | last post by:
I'm in the same boat as the fellow who posted this message back in August: Title : Windows Service, How does one make a service "fail" properly? Author : Ross Bennett Group :...
2
by: MarkZ2001 | last post by:
Hello: I'd like to set mouse and display settings programmatically without having to log out or restart. Is this possible by making registry settings and then having the winlogin process...
2
by: Tedmond | last post by:
Dear all, I wrote a service by C# but I found the service is not quite stable. I want to add some code that refresh or restart the service itself for a fixed period. Does anyone know how to...
8
by: kenneth fleckenstein nielsen | last post by:
hi guru's I want to restart my webservice when ever it throws an exception that isn't cought. can i do that by web.config or iss or how ??
5
by: Phil Tusa | last post by:
Greetings to all .... I have a need to issue a shutdown and/or Restart Windows XP inside my application. Any help or example code would be appreciated! -- Phil
1
by: chandru | last post by:
hai friends, Iam developing a application using .NET remoting ,in which it shuts down,logs off , restart , locks remote PC.i tried to use windows ExwindowsEXAPI for shutdown,logoff , restart ...
6
by: Andrew Jocelyn | last post by:
Hi How do I programmatically change (read/write) the values in this app.config file at runtime? Specifically I want to change the client endpoint address but it would be nice to change other...
8
by: K Viltersten | last post by:
I've found a number of pages describing how to restart the computer that my service runs on. The nicest one was the Black Wasp's but even there, i need to play with C++-like looking code. Is it...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.