Recent

Author Topic: Auto Shutdown Windows  (Read 16808 times)

CCRDude

  • Sr. Member
  • ****
  • Posts: 492
Re: Auto Shutdown Windows
« Reply #15 on: December 13, 2018, 07:33:18 am »
@kinlion: it's nice that you found an alternate way, but why do you think it would be better to use? Direct API usage allows to interpret possible error reasons at a fine level, while your example, well, runs. You can't evaluate if its failing because a driver blocks the reboot, or shutdown is prohibited for your privileges, or ...

kinlion

  • New Member
  • *
  • Posts: 45
  • I Love Lazarus
Re: Auto Shutdown Windows
« Reply #16 on: December 14, 2018, 10:20:57 am »
@kinlion: it's nice that you found an alternate way, but why do you think it would be better to use? Direct API usage allows to interpret possible error reasons at a fine level, while your example, well, runs. You can't evaluate if its failing because a driver blocks the reboot, or shutdown is prohibited for your privileges, or ...

OK. I just feel the code is simple :)
Lazarus 1.8.4 / FPC 3.0.4 / SVN 57972
On Win10 X64, have to compile for Win32