Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C#, wake computer from sleep

Name: Anonymous 2011-01-24 12:51

I'm creating a small alarm clock for fun, and I want to wake up the computer from sleep at a certain time.

I found this code, http://www.pcreview.co.uk/forums/showpost.php?p=11849260&postcount=4, and it works.
But.. as soon as I initiate it the program becomes unresponsive until the timer is finished.

What to do?

Name: >>2 2011-01-24 14:39

>>13
What I meant was more of a
(...) I suppose that [those particular] P/Invoke calls [as opposed to the available .NET methods] are guaranteed to work (...)
There are a few ways to do a similar thing in .NET, but I thought that while the entire .NET runtime will be paused when the system goes to sleep (and so using, say, the Timer classes would be pointless), the OS functionality which you access through P/Invoke will still be available.

After reading a bit more, it seems that the CreateWaitableTimer(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero) eventually causes WM_TIMER messages to be sent to the process/window message queue. The more you know (hosi)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List