Solved

Shutdown  NT Workstation 'Quick'

Posted on 1998-08-23
3
158 Views
Last Modified: 2010-04-04
Hello!!
I need to shut down NT Workstation Quick with all programs
active. I want to push one button, after that see shut's down not restarts.

I you can help me with this question. I'll be glad.

Thanks!!!
0
Comment
Question by:vis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
viktornet earned 50 total points
ID: 1337478
Try using

ExitWindowsEx()

Here is a snippet from the help file.....
--------------------------------
The ExitWindowsEx function either logs off, shuts down, or shuts down and restarts the system.

BOOL ExitWindowsEx(

    UINT  uFlags,      // shutdown operation
    DWORD  dwReserved       // reserved
   );      
Parameters

uFlags

Specifies the type of shutdown. This parameter must be some combination of the following values:

Value      Meaning
EWX_FORCE      Forces processes to terminate. Instead of bringing up the "application not responding" dialog box for the user, this value forces an application to terminate if it does not respond.
EWX_LOGOFF      Shuts down all processes running in the security context of the process that called the ExitWindowsEx function. Then it logs the user off.
EWX_POWEROFF      Shuts down the system and turns off the power. The application must have the SE_SHUTDOWN_NAME privilege (for more information, see the Remarks section) and the system must support the power-off feature.
EWX_REBOOT      Shuts down the system and then restarts the system. The application must have the SE_SHUTDOWN_NAME privilege (for more information, see the Remarks section).
EWX_SHUTDOWN      Shuts down the system to a point at which it is safe to turn off the power. All file buffers have been flushed to disk, and all running processes have stopped. The application must have the SE_SHUTDOWN_NAME privilege (for more information, see the Remarks section).
dwReserved

Reserved; this parameter is ignored.
-------------------

Regards,
Viktor Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1337479
I guess you need this ....

ExitWindowsEx(EWX_SHUTDOWN, 0);

Regards,
Viktor Ivanov
0
 

Author Comment

by:vis
ID: 1337480
It will not work like this. The computer logs off always not shutdowns

I need to shut down the computer
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question