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: Anonymous 2011-01-24 13:00

Do you actually understand the code?
There's no explicit "Wake up in X" function there; all the code does is it goes to sleep for a specific time, and I suppose that the P/Invoke calls are guaranteed to work even if the computer goes to sleep while the code sleeps.
Now, if the purpose of the program is to wake up your PC after a certain time, what the fuck would you want to do in the meantime?
Just spawn a background thread for the sleeping and it should work.

Name: Anonymous 2011-01-24 13:00

Do not run the program so it won't become unresponsive.

Name: Anonymous 2011-01-24 13:03

>>2
Not really, the code is way over my head.

Well, I want the GUI to be responsible until I put it to sleep, so I can cancel the alarm etc.

All right, thanks. I'll read up on threads.

Name: Anonymous 2011-01-24 13:11

>>2
P/Invoke is for calling native libs. It's basically FFI.

Name: Anonymous 2011-01-24 13:29

>>5
`implying I didn't know that
And your point?

Name: Anonymous 2011-01-24 13:32

>>6
`implying
I see what your problem is.
You're from that place.

Name: Anonymous 2011-01-24 13:35

>>7
`implying yo'ure board doesn't suck shit compared to the imageboards

Name: Anonymous 2011-01-24 13:36

>>7
`implying

Yes. I'm from the country of quote-capable people.

Name: Anonymous 2011-01-24 13:39

why not actually learn a programming language; to enable you to do this.

Or use a real alarm clock?

c# - please, excuse my giggling.

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