Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 173539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:21:42+00:00 2026-05-11T13:21:42+00:00

First time poster, be gentle ;-) I’m writing an audio app (in C++) which

  • 0

First time poster, be gentle 😉

I’m writing an audio app (in C++) which runs as a Windows service, uses WASAPI to take samples from the line in jack, and does some processing on it.

Something I’ve noticed is that when my app is ‘recording’, Windows won’t automatically suspend or hibernate.

I’ve registered for power event notifications and, if I push the suspend button myself, my service gets the appropriate power events and handles them ok. If I leave the system to suspend on its own, the power events are never received.

If I remove the bits of code where I reference WASAPI, the power events are received as normal on both manual and automatic suspend. So it seems like there’s something about using WASAPI that tells Windows to ignore the automatic suspend timer.

Can anyone help explain this behavior, and is there anything I can do to stop it? I don’t want my app to be one of those which misbehaves and prevents systems from suspending..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T13:21:43+00:00Added an answer on May 11, 2026 at 1:21 pm

    Many thanks to Larry for confirming this behaviour is by design and not me doing something silly.

    To work around this issue I used the Win32 CallNtPowerInformation() API to retrieve the system idle timer:

    SYSTEM_POWER_INFORMATION spi = {0}; NTSTATUS status = CallNtPowerInformation(SystemPowerInformation, NULL, 0,                                           &spi, sizeof(spi));  if (NT_SUCCESS(status) && (spi.TimeRemaining==0)) {     // should have gone to sleep } 

    The spi.TimeRemaining member counts down (in seconds) from the time specified by the user in Control Panel e.g. ‘System standby after 1 hour’, and gets reset whenever CPU usage (as a percentage) rises above spi.MaxIdlenessAllowed.

    If spi.TimeRemaining ever reaches zero, the system should have gone to sleep, so I close all my WASAPI handles and let it do so.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first time poster. Please be gentle. This topic may be similar to several other
first time poster, long time reader so be gentle with me :) See the
first time poster and TDD adopter. :-) I'll be a bit verbose so please
first time poster - semi-newb to Rails. Here is my question. Suppose you have
(first time poster, long time visitor via Google) I'm trying to extract the contents
First time poster here. A quick question about setting up a loop here. I
First time poster, so please excuse any stupidity. I'm working on porting a custom
First time reader, first time poster (woo!) So I've been implementing my login scripts
long time reader/first time poster here. So I've got a checkbox array that posted
First time poster. I'm using MVVM-Light with Silverlight 4 and RIA Services. This has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.