No announcement yet.

Notifying child application of Hibernation wakeup

  • Filter
  • Time
  • Show
Clear All
new posts

  • Notifying child application of Hibernation wakeup

    I have written a small radio application as my radio is not supported in Road Runner.

    In my code I have the ability to detect when the system wakes, from hibernation or suspend, and reinitialise my radio. It works when the application is not launched via RR.

    When the application is run through RR it does not receive the windows message and subsequently does not work.

    Am I right in assuming that child processes, such as those launched from RR, do not receive the WM_POWERBROADCAST message? Or should it?

    Unfortunately I have little time, as we all do, developing and tweaking my Car PC, it is left to the spare time I have on weekends and after work. I will investigate my problems more next weekend and let you know of my findings however if anyone knows of this issue please let me know.

    This is the code in my application that handles windows messages, not that it will probably help much.

    I catch the WM_POWERBROADCAST message and only run the code when the PBT_APMRESUMESUSPEND event occurs, this is sent when the system resumes from hibernation/suspend (NOTE: Code is in Borland C++):

    This the code in my application:
    void __fastcall TfrmMain::WndProc(Messages::TMessage &Message)
            bool Handled = false;
            if ((Message.Msg == WM_POWERBROADCAST) && (Message.WParam == PBT_APMRESUMESUSPEND))
                    //must reinitialise the FM Radio
                    fine_tuning_mode = false;
                    active_button = 0;
                    //detect and enable radio	
                    tmrOpen->Enabled = true;
                    Handled = true;
    Also the radio I am using is an AverMedia FM Radio. There is a project on sourceforge that has reverse engineered some of the control codes from this radio which is what forms the basis of my applicaiton. Idealy this radio would be supported by RR however I think this may be a long way off.

  • #2
    All applications implementing that message handling should receive the suspend/resume notifications regardess of RR running or not. The Base plugin code for instance has that detection on its own and it works fine with RR running or not. In any case, there's nothing in RR preventing any messages from being sent to other applications.

    Still, you can always implement the WM_COPYDATA handling and have RR send you notification of hibernate/suspend prior to actually doing using the ONSUSPEND event.. it'd be as easy as adding this line to exectbl.ini:


    Similarly you can use the ONRESUME event to notify the resume after everything has been restored as prior to hibernation/suspend.

    Also, I would advise you to call the original window handler regardless of you taking any action on that message -- meaning, remove that last IF statement.
    Ride Runner RR's Myspace

    "Being happy is not about having what you want, it's about wanting what you have."
    "The best things in life are always free - but that doesn't mean money can't buy you good things."


    • #3
      Geez I feel so stupid!

      After some debuging of my code I found no problems and verified that my application was reciving the message. The problem lay in the physical USB connection inside the case. Thanks for the info guino might be handy in future projects.

      Thanks Again!