When using
InitiateSystemShutdown(null, null, 0, true, false);
some weird things happen. It all works well when I just call the function, also works fine build in my shut-down timer application but the thing is that it does not shut down pc when it's idle for 30+ min and my monitors turn off.
I used other functions to try and shut down the system but I come across the same problem whatever I use. The system does not go to sleep or hibernate or anything like that, it just turns off the displays.
is there a need to "wake" system up somehow prior to calling the function or anything like that.
Method declared as:
static extern bool InitiateSystemShutdown(
[MarshalAs(UnmanagedType.LPStr)] string lpMachinename,
[MarshalAs(UnmanagedType.LPStr)] string lpMessage,
Int32 dwTimeout,
bool bForceAppsClosed,
bool bRebootAfterShutdown);