Posted on Thursday June 18, 2009

Wake up from Sleep (CreateWaitableTimer) in C#

This code isn’t mine, but from a newsgroup posting on by MVP Willy Denoyette (I couldn’t find a homepage to link). I’m reposting it here for my own benefit, safe in the knowledge it will never disappear unless my database backup corrupts.

The code illustrates how to set a timer to wake your computer up having been sleep’d. It’s tested on Vista and Windows 7 with sleep mode. I haven’t tried it with a laptop or hibernating however.

I’ll be making it into a winforms in the future soon, that sits in the system tray - I’ll update the page and make a google code project when this is done.