473,396 Members | 2,002 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,396 software developers and data experts.

Shutdown Workstation

Hi there,

I would like to know how to write a simple program to shut down my
workstation. I searched the MSDN but I could not find any hint for my
problem. Perhaps I searched for the wrong keywords?!?
It would be very kind if someone would help me.

Best Jean
Nov 16 '05 #1
2 1653
ClearShort_Answer wrote:

Hi there,

I would like to know how to write a simple program to shut down my
workstation. I searched the MSDN but I could not find any hint for my
problem. Perhaps I searched for the wrong keywords?!?
It would be very kind if someone would help me.

Best Jean


From the command line:

%windir%\System32\shutdown.exe -s -t 0

Using C#:

[DllImport ("user32")]
public static extern int ExitWindowsEx(int dwReserved, int uReturnCode);

const int EWX_LOGOFF = 0;
const int EWX_SHUTDOWN = 1;
const int EWX_REBOOT = 2;
const int EWX_FORCE = 4;

ExitWindowsEx(0, EWX_SHUTDOWN|EWX_FORCE);
Nov 16 '05 #2
Check this out:
http://www.dotnet247.com/247referenc...45/229082.aspx

Eran Kampf
http://www.ekampf.com

"ClearShort_Answer" <de**********@web.de> wrote in message
news:41***********************@newsread2.arcor-online.net...
Hi there,

I would like to know how to write a simple program to shut down my
workstation. I searched the MSDN but I could not find any hint for my
problem. Perhaps I searched for the wrong keywords?!?
It would be very kind if someone would help me.

Best Jean

Nov 16 '05 #3

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

Similar topics

0
by: Hansi | last post by:
How can i start a winforms application on remote workstation, no matter who or if there is somebody logged in? My problems: 1) I need to shutdown computers in the evening that have not been...
0
by: Tom Simpson | last post by:
I've written a Windows Service using VB.NET, which does a connection to a database and then runs a timer to periodically process some data. It is running pretty well; However, I have noticed one...
6
by: Mr Newbie | last post by:
Whatever I do I cant programatically make my machine shutdown. I am using the following class and have tried both thte ExitWindowsEx and InititateSystemShutdownEx shared functions Neither seem to...
0
by: Hansi | last post by:
How can i start a winforms application on remote workstation, no matter who or if there is somebody logged in? My problems: 1) I need to shutdown computers in the evening that have not been...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
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,...
0
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...
0
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...
0
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...
0
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...
0
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,...

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.