This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Register | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General Discussion
 General Discussion
 How to hybernate Computer with StrokesPlus
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

gwerdi

Switzerland
4 Posts

Posted - 04/28/2014 :  10:10:52  Show Profile  Visit gwerdi's Homepage  Reply with Quote
Hi everyone.
I'm looking for a way to set my Windows XP computer to hybernate with a gesture. Anybody has a hint for me? On Google i found a command to use hybernate as a shortcut: %systemroot%\System32\rundll32.exe powrprof.dll,SetSuspendState

Rob

USA
2606 Posts

Posted - 04/28/2014 :  11:17:39  Show Profile  Visit Rob's Homepage  Reply with Quote
I put this together and it works for me on Windows 8.1, though MSDN states it should work for WinXP as well:

Under Global Lua:
powrprof = alien.core.load("powrprof.dll")

gSetSuspendState = powrprof.SetSuspendState
gSetSuspendState:types{ret = 'long', abi = 'stdcall', 'long', 'long', 'long'}
function aSetSuspendState(Hibernate, ForceCritical, DisableWakeEvent)
	return gSetSuspendState(Hibernate, ForceCritical, DisableWakeEvent)
end

Action Lua Script:
local bHibernate = true
local bForceCritical = true
local bDisableWakeEvent = false

aSetSuspendState(bHibernate, bForceCritical, bDisableWakeEvent)


See this link for the specifics regarding the three possible parameters:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa373201.aspx


Go to Top of Page

gwerdi

Switzerland
4 Posts

Posted - 04/28/2014 :  12:12:06  Show Profile  Visit gwerdi's Homepage  Reply with Quote
Thank you very much for your help. The script seems to work but the computer just suspends instead of hybernating. If I set the computer to hybernate manually (Shift Click on Standby) it hybernates correctly.
Go to Top of Page

Rob

USA
2606 Posts

Posted - 04/28/2014 :  13:25:24  Show Profile  Visit Rob's Homepage  Reply with Quote
Have you tried setting the second parameter (bForceCritical) to false? The documentation isn't clear, but suggests it may cause a suspend to be invoked.
local bHibernate = true
local bForceCritical = false
local bDisableWakeEvent = false

aSetSuspendState(bHibernate, bForceCritical, bDisableWakeEvent)
Go to Top of Page

gwerdi

Switzerland
4 Posts

Posted - 04/29/2014 :  03:20:49  Show Profile  Visit gwerdi's Homepage  Reply with Quote
I just tried to set bForceCritical to false but I get the same effect.
Go to Top of Page

Rob

USA
2606 Posts

Posted - 04/29/2014 :  10:58:35  Show Profile  Visit Rob's Homepage  Reply with Quote
Hmm, I'm not sure why that doesn't work as it seems the MSDN documentation states that's what it should do!

I'll get back to you if I have any other ideas; though you may do some searches to see if there's a small utility program you can call from S+...such as http://nircmd.nirsoft.net/hibernate.html
Go to Top of Page

gwerdi

Switzerland
4 Posts

Posted - 05/02/2014 :  08:52:47  Show Profile  Visit gwerdi's Homepage  Reply with Quote
Thank you for your support. I'll try out the way with a utility. Seems to be the easiest way:)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000