1,105,633 Community Members

Put computer to sleep with C++ or VBS?

Member Avatar
VBNick
Junior Poster
151 posts since Jan 2008
Reputation Points: 3 [?]
Q&As Helped to Solve: 5 [?]
Skill Endorsements: 0 [?]
 
0
 

Is there a way to put a computer to sleep somehow other than clicking start, then sleep?

I am using a shortcut to this right now:
C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState 0,1,0

but it doesnt do the same thing as clicking "Sleep" in the start menu.

I need a piece of C++ code, vbs script, shortcut key, or any way to trigger sleep mode, or trigger the default power button function. Can anyone help?

Member Avatar
VBNick
Junior Poster
151 posts since Jan 2008
Reputation Points: 3 [?]
Q&As Helped to Solve: 5 [?]
Skill Endorsements: 0 [?]
 
0
 

after a long and extremely frustrating search, I found that the creating a shortcut to "C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState" ACUALLY IS the solution..except that I had to go into power management and disable hybrid sleep..I think that did it. But as I was so frustrated, I also found that running

powercfg.exe /hibernate off

removes the option from the power management menu completely.

Good Night :yawn:

edit-
for anyone who is on the same page as me, I also found an option to disable wake timers in there, and found that I could disable wake functions from the device manager device properties for all devices except my main keyboard. My computer would sometimes wake up 5 minutes after putting it to sleep...which was EXTREMELY inconvenient as my computer is not within arms reach of my bed(good thing it isnt:angry:)

Question Self-Answered as of 3 Years Ago
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article