Results 1 to 3 of 3

Thread: Notifying child application of Hibernation wakeup

  1. #1
    Newbie
    Join Date
    Jun 2005
    Posts
    16

    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:
    Code:
    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;
    
            }
    
            if(!Handled)
            TForm::WndProc(Message);
    }
    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. #2
    RoadRunner Mastermind
    Auto Apps:loading...
    guino's Avatar
    Join Date
    Nov 2004
    Location
    Toronto, Canada
    Posts
    9,818
    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:

    "ONSUSPEND","SENDMSG;<MYAPPWINDOWTITLE>;<MESSAGETO APPLICATION"

    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. #3
    Newbie
    Join Date
    Jun 2005
    Posts
    16
    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!

Similar Threads

  1. 5 minutes to complete hibernation? WTF?
    By DRWeside in forum General Hardware Discussion
    Replies: 1
    Last Post: 03-12-2006, 10:36 PM
  2. How to embbed any Application in RR ?
    By guino in forum RR FAQ
    Replies: 0
    Last Post: 03-20-2005, 12:35 PM
  3. Odd Off Topic-ness on Hibernation
    By Vchat20 in forum General MP3Car Discussion
    Replies: 1
    Last Post: 01-31-2005, 05:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •