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 8323695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:48:00+00:00 2026-06-08T23:48:00+00:00

I register my application to receive notification when the system is suspended or resumed.

  • 0

I register my application to receive notification when the system is suspended or resumed.
MSDN documentation

Function I’d like to be executed after application receives notification (I tried both void and void CALLBACK and both work same way):

void isConnectedStandby()
{
    printf( "ConnectedStandby Request");
}

1st case – I provide pointer to the isConnectedStandby function, but system treats as a double pointer to the function – it calls an address which is under this callback pointer.

HPOWERNOTIFY RegistrationHandle;

PowerRegisterSuspendResumeNotification(
      DEVICE_NOTIFY_CALLBACK,
      &isConnectedStandby,
      &RegistrationHandle
);

2nd case – here I provide as follows (this way my function code is executed):

typedef void (*StatusFunction_t)(); 
StatusFunction_t StatusFunction = isConnectedStandby;
HPOWERNOTIFY RegistrationHandle;

    PowerRegisterSuspendResumeNotification(
      DEVICE_NOTIFY_CALLBACK,
      &isConnectedStandby,
      &RegistrationHandle
);

System calls not only mine function, but all addresses after the first one (if I provide an array of functions, it executes one after another to crash when there is no valid code available)

What is the correct way to use this function?

  • 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. Editorial Team
    Editorial Team
    2026-06-08T23:48:02+00:00Added an answer on June 8, 2026 at 11:48 pm

    Function declaration (must be static ULONG with 3 parameters as you can see below):

    static ULONG isConnectedStandby(PVOID Context, ULONG Type, PVOID Setting);
    
    ULONG isConnectedStandby(PVOID Context, ULONG Type, PVOID Setting)
    {
        printf( "ConnectedStandby Request");
        return 0;
    }
    

    Istead of providing callback function directly to PowerRegisterSuspendResumeNotification we have to provide struct _DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS filled with our functions address :

    static _DEVICE_NOTIFY_SUBSCRIBE_PARAMETERS testCallback = {
        isConnectedStandby,
        nullptr
        };
    HPOWERNOTIFY RegistrationHandle;
    
    PowerRegisterSuspendResumeNotification(
      DEVICE_NOTIFY_CALLBACK,
      &testCallback,
      &RegistrationHandle
    );
    

    MSDN documentation did not mention any of those information.

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

Sidebar

Related Questions

In my application, I have registered a broadcast receiver to receive the system intent
In reading some android documentation, it seems like intent-filter indicates what intents the application
how can I register my application so that when I receive a sms my
An application I have recently started work on has to register two dll's, because
I am working on an application which contain register activity as it's first page
I have a freelance web application that lets users register for events. In my
I am developing an iPhone application for car dealers who would register with my
I'm trying to allow users to register on my web application via Facebook. As
I have a web application where I am doing a Response.Redirect(Register.aspx) page in a
I have register my MBean app this way: ObjectName appName = new ObjectName(testpack.Application:name=myApp); MBeanServer

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.