View Full Version : Avoid Suspend Mode or Hibernate action
chris_bdnsee
15-03-2009, 20:31
Good evening,
has anybody of you tried to keep Windows "alive" (don't go into the suspend mode and avoid the hibernate action) with a thinbasic script ?
I have tried the API call of SetThreadExecutionState, but did not succeeded.
Just curious.....
Any suggestion is appreciated.
best regards
Christian
ErosOlmi
15-03-2009, 22:52
Interesting request I've never got in touchwith.
One of the beauty of thinBasic is that in many aspects it follows Windows standards so looking at official MS docs can give direct info to put in practice.
Mainly, when Windows needs to suspend, it sends various notification messages. If those notifications are correctly intercepted, just follow MS docs and the trick is (seems :D ) done.
More info at:
http://msdn.microsoft.com/en-us/library/aa373245(VS.85).aspx
http://msdn.microsoft.com/en-us/library/aa373247(VS.85).aspx
Attached to this message a thinBasic program that should do what you need.
Attention: some notification messages are compatible only with specific Windows versions.
Let me know if it works.
Ciao
Eros
chris_bdnsee
17-03-2009, 09:43
Good Morning Eros,
works great ! :P
Again thank you for delivering not only the solution but providing me more insights on TB....(and a good template for analyzing more messages from Windows)
best
Christian