Solved

Shutdown  NT Workstation 'Quick'

Posted on 1998-08-23
3
151 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
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
viktornet earned 50 total points
Comment Utility
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
Comment Utility
I guess you need this ....

ExitWindowsEx(EWX_SHUTDOWN, 0);

Regards,
Viktor Ivanov
0
 

Author Comment

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

I need to shut down the computer
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now