I want use C# to restart my computer,
how to? 3 8231
[DllImport("adva pi32.dll", EntryPoint="Ini tiateSystemShut down")]
public static extern int InitiateSystemS hutdownA(string lpMachineName,
string lpMessage, int dwTimeout, int bForceAppsClose d, int
bRebootAfterShu tdown);
public void RestartPC(objec t sender, System.EventArg s e)
{
int restartcode=Ini tiateSystemShut downA("\\127.0. 0.1", "Restart... ", 10,
1, 1);
MessageBox.Show ("OK"+restartco de);
}
Am i right?
but the parameter restartcode is 0,and my computer still run.
"W.G. Ryan eMVP" <Wi*********@No Spam.gmail.com> wrote in message
news:un******** ******@tk2msftn gp13.phx.gbl... You cna use the API http://custom.programming-in.net/art...SystemShutdown Or you can freestyle and just loop through each active process on your computer and shut it down -
-- W.G. Ryan MVP (Windows Embedded)
TiBA Solutions www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com <lz**@0536.ne t> wrote in message news:uy******** ******@TK2MSFTN GP11.phx.gbl... I want use C# to restart my computer,
how to?
You can also use WMI to do this, this will allow you to also reboot remote
machines, as well as force reboots so that it will not hault to get a user
key press to end tasks.
<lz**@0536.ne t> wrote in message
news:Ob******** ******@tk2msftn gp13.phx.gbl... [DllImport("adva pi32.dll", EntryPoint="Ini tiateSystemShut down")] public static extern int InitiateSystemS hutdownA(string lpMachineName, string lpMessage, int dwTimeout, int bForceAppsClose d, int bRebootAfterShu tdown); public void RestartPC(objec t sender, System.EventArg s e) { int restartcode=Ini tiateSystemShut downA("\\127.0. 0.1", "Restart... ", 10, 1, 1); MessageBox.Show ("OK"+restartco de); }
Am i right?
but the parameter restartcode is 0,and my computer still run.
"W.G. Ryan eMVP" <Wi*********@No Spam.gmail.com> wrote in message news:un******** ******@tk2msftn gp13.phx.gbl... You cna use the API http://custom.programming-in.net/art...SystemShutdown Or you can freestyle and just loop through each active process on your computer and shut it down -
-- W.G. Ryan MVP (Windows Embedded)
TiBA Solutions www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com <lz**@0536.ne t> wrote in message news:uy******** ******@TK2MSFTN GP11.phx.gbl... I want use C# to restart my computer,
how to?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Piotr Trawiński |
last post by:
I have this notorious problem: at some point pgsql simply hangs up and
requires a restart.
---------------------------------------------------------------------------
-------
homer:/usr/share/doc/postgresql-contrib# /etc/init.d/postgresql restart
Restarting PostgreSQL database: postmaster
Stopped /usr/lib/postgresql/bin/postmaster (pid 14243 14245 14247 14750
14811 1489 15569 15570 15573 15584 15643 15644 15665 15800 15801
15804 15817...
|
by: localhost |
last post by:
In the Application_OnStart, I make some data calls and place the
results in the HTTP cache. Sometimes, the database is not available
when the application starts up, so I want to sleep for 20 seconds and
then restart the entire application.
What is the best way to do that?
Thanks.
|
by: amdishigh |
last post by:
We are experiencing the following problems concerning ASP.NET: our
ASP.NET application, written in .NET 1.1 platform, and hosted in IIS 5.0
environment, experience frequent session timeout problem. After tracing, we
find that it should be caused by "ASP.NET Application Restart" (proved by
incremented counter for "Application Restarts" of "ASP.NET 1.1.4322" in
"Performance" whenever the timeout happens).
From MSDN documentation, we find...
|
by: Pint |
last post by:
I would like to know if there is a programatic way to force the
Application object to restart. I have a hosted website where I will be
unable to control the webserver (eg:iisreset), and I would like to be
able to trap certain events and cause the entire application to reload.
Thanks in advance.
-Pint
|
by: John A Grandy |
last post by:
In ASP.NET 1.1 and/or 2.0 .....
Is it possible to configure a web-app so that replacement of an .xml file
( physically located under the virtual dir root ) with a newer version of
the file causes a web-app restart ... ?
Also, is a stopping and starting a website in IIS the only way to restart a
web-app ?
(Of course, iisreset stops and starts all web-apps on the web-server ... but
| |
by: Leonardo Curros |
last post by:
Hello,
I would like to know what's the best way to restart one service. I
would like to do it from the service itself. Is this possible?
I try it with
ServiceController.stop()
ServiceController.WaitForStatus(ServiceControllerStatus.Stopped)
ServiceController.start()
but doesn´t works. It seems waitforstatus instruction is the last
|
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 ??
|
by: shorti |
last post by:
Can anyone explain in greater (and more comprehensive) detail what the
RESTART option does in the ALTER TABLE table ALTER COLUMN statement.
This is the description in Info Center:
RESTART or RESTART WITH numeric-constant
Resets the state of the sequence associated with the identity column.
If WITH numeric-constant is not specified, the sequence for the
identity column is restarted at the value that was specified, either
implicitly or...
|
by: MarkusJNZ |
last post by:
Hi, I have two different applications running on 2003 both in two
different vitrual directories. One application runs on the .NET
framework 1.1 whilst the other runs on 2.0.
If I change the framework version (via IIS admin ASP.NET tab) for
either application (Initally the 2.0 app was recognised by IIS as 1.1)
does this force IIS to restart?
?? Any links to further reading would be good.
|
by: Brian Simmons |
last post by:
Hi All,
I know that if you modify the web.config file or any file in the App_Code
subfolder, that ASP.net 2.0 will "restart" the application (i.e. clear out
any sessions, etc...).
Are there any other changes that restart the application? Will modify a
code-behind .cs/.vb which calls a class in the App_Code folder restart the
application?
|
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...
| |
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...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |