Выключение ПК (API), Ошибка при выполнении ф-ции ExitWindowsEx
Пользователь
Сообщений: Регистрация: 24.12.2012
29.12.2012 13:28:49
С Наступающим НОВЫМ ГОДОМ!!!
Подскажите пожалуйста в чем дело. Выключаю ПК функцией API ExitWindowsEx(EWX_SHUTDOWN, 0) Ексел дает сообщение типа "Невозможно закрыть Микрософт Ексель"
Пользователь
Сообщений: Регистрация: 22.12.2012
29.12.2012 14:00:36
Цитата
ExitWindowsEx(EWX_SHUTDOWN, 0)
курим шпаргалку от разработчика: dwReason [in]
The reason for initiating the shutdown. This parameter must be one of the system shutdown reason codes.
If this parameter is zero, the SHTDN_REASON_FLAG_PLANNED reason code will not be set and therefore the default action is an undefined shutdown that is logged as "No title for this reason could be found". By default, it is also an unplanned shutdown. Depending on how the system is configured, an unplanned shutdown triggers the creation of a file that contains the system state information, which can delay shutdown. Therefore, do not use zero for this parameter.
подробнее здесь: и здесь:
Изменено: - 29.12.2012 14:02:06
фрилансер Excel, VBA - контакты в "Совершенствоваться не обязательно. Выживание — дело добровольное." Э.Деминг
Пользователь
Сообщений: Регистрация: 23.12.2012
29.12.2012 14:00:47
А почему не использовать командную строку и команду shutdown ?
Пользователь
Сообщений: Регистрация: 21.12.2012
29.12.2012 14:15:08
Код
Sub Shut_Down()
Shell "cmd.exe /c shutdown /s /f /t 0"
End Sub