Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

disable suspend/hibernate during program execution

Featured Replies

Hi all,

I have to disable suspend and hibernation during the execution of my program. Otherwise my program will abort during suspend/hibernation.

I've tried it with powercfg.exe but unfortunately my program is running as a service and powercfg.exe did not work as expected.

I've also tried the registry fixes from sam13484 (http://www.msfn.org/board/Disable-standby-tweak-t74843.html) but they also did not work.

Anyone have experience with that?

It is possible to disable hibernate/suspend by a script or program and reenable the previous user settings after program is finished?

Thanks in advance

AthLux

  • Author

Thanks.

On my WindowsXP I've installed Microsoft Visual C++ and developed 2 little programs:

- DisableSuspend.exe - which calls SetThreadExecutionState ( ES_CONTINUOUS | ES_SYSTEM_REQUIRED )

- EnableSuspend.exe - which calls SetThreadExecutionState ( ES_CONTINUOUS )

Both programs work in WindowsXP but have no effect within Windows Vista :unsure:

I am really new in windows-programming. This are my first programs ;-)

Did you have a hint what is my mistake?

Thanks

AthLux

Yes, if you read the MSDN article closely, the APIs changed from XP/2003 to Vista/2008, and the new APIs were at the top of the list.

  • Author

I do not fully understand.

In http://msdn.microsoft.com/en-us/library/aa373163(VS.85).aspx a set of functions is listet. At the bottom some functions listet which are incompatible between XP and Vista.

But the function I want to use is "SetThreadExecutionState" which is not listet in this bottom table.

The function is described in detail in http://msdn.microsoft.com/en-us/library/aa373208(VS.85).aspx. Because of the bottom of this page, Requirements, I would assume that it should work in W2000, XP, Vista as well as Windows Server 2000-2008.

Thanks for your help

AthLux

You are correct, this does appear to be something Vista supports. If it's not working, I'd consider using GetLastError to see what the return value was (check for NULL, as that is the return if it fails).

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.