Top.Mail.Ru
Мастера DELPHI, Delphi programming community Титульная страница Поиск, карта сайта Написать письмо 
| Новости | Поиск | FAQ | Статьи | Книги | Новости VCL |
| Форумы ЧАТ | Орешник | KOL и MCK |
Форумы -» Основная («Начинающим»)/ Базы / WinAPI / Компоненты / Сети / Media / Игры / Corba и COM / KOL / FreePascal / .Net / Прочее / RSDN.ORG

« предыдущая ветвь | форум | следующая ветвь »

Полный ShutDown [D6, Win95/98, WinME, NT4, Win2k, WinXP]


IlyaA ©   (2002-07-17 14:36:00) 

Как можно програмно выключить комьютер или ребутнуть его.


IlyaA   (2002-07-18 13:35:00) [1]

Большое спасибо. Извиняюсь за глупый вопрос.
Что-то совсем ленивый стал, даже в MSDN лень залесть. Надо воспитываться.


andrey_pst   (2002-07-18 11:50:00) [2]

функции WinAPI:
1) ExitWindows() - использовалась в Win16 (под Win32 тоже работает)
2) ExitWindowsEx() - используется в Win32

Первая только перезагружает компутер, вторая могет и ребут и сеанс закончить и питание выключить вобщем см. ниже (ангхлицкий надеюсь знаешь).

Обе лично использовал в Win98/ME с семейством NT юзать её не пробовал.
Удачи :)

У первой оба параметра зарезервированы у второй первый параметр это флаги говорящие как выполнять выход:

EWX_FORCE
Forces processes to terminate. When this flag is set, Windows does not send the messages WM_QUERYENDSESSION and WM_ENDSESSION to the applications currently running in the system. This can cause the applications to lose data. Therefore, you should only use this flag in an emergency.

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 system must support the power-off feature.Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section. Windows 95: Security privileges are not supported or required.

EWX_REBOOT
Shuts down the system and then restarts the system. Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section. Windows 95: Security privileges are not supported or required.

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. Windows NT: The calling process must have the SE_SHUTDOWN_NAME privilege. For more information, see the following Remarks section. Windows 95: Security privileges are not supported or required.


Song   (2002-07-17 15:09:00) [3]

В FAQ есть.


Наверх

Титульная страница Поиск, карта сайта Написать письмо