Question

I need to create a program in c# code that will sleep my machine for X mins and then resume from sleep mode. I have written a program to sleep\hibernate my machine using PowerState.Suspend which I run on one thread and then I set a timer for x mins after which I run System.Windows.Forms.Application.Run(); to resume from sleep. I have been searching all over but alas, I am still not happy.

Does anyone have any ideas of how I can resume my laptop from a sleep state in C#

OTHER TIPS

You'll have to use P/invoke to call call the CreateWaitableTimer and SetWaitableTimer functions.

See the MSDN documentation and this example of calling the functions from C#.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top