Sign in to follow this  
Followers 0
xManh

How to perform system standby

9 posts in this topic

Please help me how to make the computer goes to stand by.

I found shutdown function but it only supports shutdown, restart, hibernate... but not stand by

Share this post


Link to post
Share on other sites



i do think 64 is hibernate :lmao: in the help file

0 = Logoff
1 = Shutdown
2 = Reboot
4 = Force
8 = Power down
32= Suspend
64= Hibernate

Share this post


Link to post
Share on other sites

:lmao:

;Standby like this

SetSuspend()

Func SetSuspend($mode=true,$force=true)

$result = DllCall("PowrProf.dll", "long", "SetSuspendState", "long",$mode, "long",$force, "long", false)

EndFunc

Share this post


Link to post
Share on other sites

:lmao:

;Standby like this

SetSuspend()

Func SetSuspend($mode=true,$force=true)

$result = DllCall("PowrProf.dll", "long", "SetSuspendState", "long",$mode, "long",$force, "long", false)

EndFunc

Not really necessary. All you need to do is this:

Shutdown(4+32);4 is to force it and 32 is to set it in standby(also known as suspend)

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

I'm sorry but but your all solutions don't work

Func SetSuspend($mode=true,$force=true)

$result = DllCall("PowrProf.dll", "long", "SetSuspendState", "long",$mode, "long",$force, "long", false)

EndFunc

This perform system hibernate which is different from standby

@The Kandie Man

Shutdown(4+32) does not make the computer standby too

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

you must call the function first !

;Standby like this

SetSuspend()

Func SetSuspend($mode=true,$force=true)

$result = DllCall("PowrProf.dll", "long", "SetSuspendState", "long",$mode, "long",$force, "long", false)

EndFunc

for me (XP system) it works ! Compile it and start it

Edited by Micha1405

Share this post


Link to post
Share on other sites

I'm sorry but but your all solutions don't work

This perform system hibernate which is different from standby

@The Kandie Man

Shutdown(4+32) does not make the computer standby too

My apologies. Upon closer inspection i found that the function doesn't allow a forced suspend(aka standby). All you needed to do to fix the code remove the 4.

Shutdown(32)

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

@Micha1405

I have copied and compiled your code but It still hibernated. I'm using Xp sp2 too. May be there is wrong in the parameters?

@The Kandie Man

Shutdown(32)
works well, thank you very much

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

@Micha1405

I have copied and compiled your code but It still hibernated. I'm using Xp sp2 too. May be there is wrong in the parameters?

@The Kandie Man

Shutdown(32)
works well, thank you very much
may be the settings @ power option are diffrent ?!? I use this on my notebook and it works ! Hibernate is deactivated on my Notebook Edited by Micha1405

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0