locked
how to sleep and awake a computer RRS feed

  • Question

  • Greetings!,

    is it possible to put a computer sleep and awake when i press a button? i will use this for my thesis...tnx

    Thursday, December 4, 2014 7:30 AM

Answers

  • Hi

    Yes it is possible, you can do it using C# code.

    To sleep

    Application.SetSuspendState(PowerState.Suspend, falsefalse);

    To wake up

    http://www.anotherchris.net/csharp/wake-up-from-sleep-createwaitabletimer-in-csharp/


    Thanks & Regards
    Syed Amjad Sr. Silverlight/WPF Developer,
    yahoo : syedamjad6736@yahoo.com, skype : syedamjad.0786.
    Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    What is wrong here .. VB Forum here

    You can do it using VB code 

    • Proposed as answer by Carl Cai Friday, December 19, 2014 8:45 AM
    • Marked as answer by Youjun Tang Friday, December 19, 2014 8:47 AM
    Thursday, December 4, 2014 11:10 AM
  • Hi

    Yes it is possible, you can do it using C# code.

    To sleep

    Application.SetSuspendState(PowerState.Suspend, falsefalse);

    To wake up

    http://www.anotherchris.net/csharp/wake-up-from-sleep-createwaitabletimer-in-csharp/


    Thanks & Regards
    Syed Amjad Sr. Silverlight/WPF Developer,
    yahoo : syedamjad6736@yahoo.com, skype : syedamjad.0786.
    Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    • Proposed as answer by Carl Cai Friday, December 19, 2014 8:45 AM
    • Marked as answer by Youjun Tang Friday, December 19, 2014 8:47 AM
    Thursday, December 4, 2014 9:27 AM
  • Hi,

     As has been said, you can use the Application.SetSuspendState Method to put the system into sleep mode. You can check out the link and read what the 3 parameters are used for.

     However, i don`t understand how you plan on waking the system by pressing a button. You will have to wake the system before you would be able to press the button on your app. Perhaps you mean you want to press the button to put the system to sleep for a certain amount of time and then have it automatically wake the system ??   8)


    If you say it can`t be done then i`ll try it

    • Proposed as answer by Carl Cai Friday, December 19, 2014 8:44 AM
    • Marked as answer by Youjun Tang Friday, December 19, 2014 8:47 AM
    Thursday, December 4, 2014 11:52 AM

All replies

  • Hi

    Yes it is possible, you can do it using C# code.

    To sleep

    Application.SetSuspendState(PowerState.Suspend, falsefalse);

    To wake up

    http://www.anotherchris.net/csharp/wake-up-from-sleep-createwaitabletimer-in-csharp/


    Thanks & Regards
    Syed Amjad Sr. Silverlight/WPF Developer,
    yahoo : syedamjad6736@yahoo.com, skype : syedamjad.0786.
    Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    • Proposed as answer by Carl Cai Friday, December 19, 2014 8:45 AM
    • Marked as answer by Youjun Tang Friday, December 19, 2014 8:47 AM
    Thursday, December 4, 2014 9:27 AM
  • Hi

    Yes it is possible, you can do it using C# code.

    To sleep

    Application.SetSuspendState(PowerState.Suspend, falsefalse);

    To wake up

    http://www.anotherchris.net/csharp/wake-up-from-sleep-createwaitabletimer-in-csharp/


    Thanks & Regards
    Syed Amjad Sr. Silverlight/WPF Developer,
    yahoo : syedamjad6736@yahoo.com, skype : syedamjad.0786.
    Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    What is wrong here .. VB Forum here

    You can do it using VB code 

    • Proposed as answer by Carl Cai Friday, December 19, 2014 8:45 AM
    • Marked as answer by Youjun Tang Friday, December 19, 2014 8:47 AM
    Thursday, December 4, 2014 11:10 AM
  • Hi,

     As has been said, you can use the Application.SetSuspendState Method to put the system into sleep mode. You can check out the link and read what the 3 parameters are used for.

     However, i don`t understand how you plan on waking the system by pressing a button. You will have to wake the system before you would be able to press the button on your app. Perhaps you mean you want to press the button to put the system to sleep for a certain amount of time and then have it automatically wake the system ??   8)


    If you say it can`t be done then i`ll try it

    • Proposed as answer by Carl Cai Friday, December 19, 2014 8:44 AM
    • Marked as answer by Youjun Tang Friday, December 19, 2014 8:47 AM
    Thursday, December 4, 2014 11:52 AM
  • Greetings!,

    is it possible to put a computer sleep and awake when i press a button? i will use this for my thesis...tnx

    I hope this is like an elementary school thesis if all it has to do with is placing a computer in sleep mode by selecting a button.

    However you can't wake a computer by selecting a button as no button, application or anything else is displayed while a computer is in sleep mode.

    You can wake a computer at a preset time or time interval with your app once your app places a computer in sleep mode.

    Here's how I wake my computer.


    La vida loca

    Thursday, December 4, 2014 12:25 PM
  • Here's how I wake my computer.


    La vida loca

     And here is how you put it to sleep rite ?


    If you say it can`t be done then i`ll try it

    Thursday, December 4, 2014 12:38 PM
  • Here's how I wake my computer.


    La vida loca

     And here is how you put it to sleep rite ?


    If you say it can`t be done then i`ll try it


    You got it! ROTFLMAO!

    La vida loca

    Friday, December 5, 2014 6:31 AM
  • I'am developing an internet cafe system it is my thesis, if it is successful it will be used in our school... :)

    Wednesday, December 10, 2014 1:13 AM
  • haha the picture is  funny...
    Wednesday, December 10, 2014 1:13 AM
  • I'm serious sir....
    Wednesday, December 10, 2014 1:15 AM
  • So are they - how can you expect to wake up the computer by pressing a button when there is only a black screen?

    Wednesday, December 10, 2014 6:50 PM
  • I I'am developing an internet cafe timer, and I will be using that code...
    Sunday, January 18, 2015 10:56 PM