Страницы: 1
RSS
Выключение ПК (API), Ошибка при выполнении ф-ции ExitWindowsEx
 
С Наступающим НОВЫМ ГОДОМ!!!

Подскажите пожалуйста в чем дело.
Выключаю ПК функцией API
ExitWindowsEx(EWX_SHUTDOWN, 0)
Ексел дает сообщение  типа "Невозможно закрыть Микрософт Ексель"
 
Цитата
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.

подробнее здесь: http://msdn.microsoft.com/en-us/library/aa376868(VS.85).aspx
и здесь: http://msdn.microsoft.com/en-us/library/aa376885(v=VS.85).aspx
Изменено: ikki - 29.12.2012 14:02:06
фрилансер Excel, VBA - контакты в профиле
"Совершенствоваться не обязательно. Выживание — дело добровольное." Э.Деминг
 
А почему не использовать командную строку и команду shutdown ?
 
Код
Sub Shut_Down()
    Shell "cmd.exe /c shutdown /s /f /t 0"
End Sub
Изменено: Johny - 29.12.2012 14:15:28
There is no knowledge that is not power
 
Всем спасибо.
Еще раз С НОВЫМ ГОДОМ!!!
Страницы: 1
Читают тему
Наверх