1

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); 
Alex K
  • 8,269
  • 9
  • 39
  • 57
Lurker
  • 17
  • 1
  • How are you declared `InitiateSystemShutdown`? – Hamlet Hakobyan Jan 23 '13 at 15:51
  • static extern bool InitiateSystemShutdown( [MarshalAs(UnmanagedType.LPStr)] string lpMachinename, [MarshalAs(UnmanagedType.LPStr)] string lpMessage, Int32 dwTimeout, bool bForceAppsClosed, bool bRebootAfterShutdown); – Lurker Jan 23 '13 at 15:53
  • Although the computer is not in sleep/hibernate mode, turning off the monitors does indicate that the PC is turning off some functionality. Have you tried programmatically waking the machine before initiating the shutdown? – P.Brian.Mackey Jan 23 '13 at 15:58
  • well that's the one thing i did not try. I ma looking for a good way to do that and will let you know of the results. that's the only thing left that i think of. – Lurker Jan 23 '13 at 15:59

0 Answers0