locked
Minimized DirectX metro-app fails to go to suspended state

    Question

  •  

    I'm creating a metro style game using Direct3D. My code is based on the example "Simple Direct3D 11.1 Game Sample". I added the following suspending event handler: 

     

    ref class D3DView
    {
        ...
        void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args) {
            // some code 
        }
        ...
    };
    
    D3DView::D3DView(...)
    {
        ...
        Windows::ApplicationModel::Core::CoreApplication::Suspending +=
            ref new EventHandler<Windows::ApplicationModel::SuspendingEventArgs^>(this, &D3DView::OnSuspending);
        ...
    }
    
    

    However, D3DView::OnSuspending isn't called at all if the game is minimized or if I run other metro style apps at the same time.
    The Task Manager shows that the process for the game is still running and not suspended while the processes for pre-installed apps like Stocks, News, Tweerama etc are suspended.
    Why the process for the game is not suspended in this case? Does this mean that there's an error in the game or that there's a bug in the OS?

     

    Thanks.

    Friday, January 27, 2012 12:29 PM

All replies

  • Hi P,

    Are you running your app in the debugger?  When debugging it will not suspend.  You can simulate the event however from the debugger:

    In the debugger choose 'Debug', 'Trigger Suspend'

    -Jeff 


    Jeff Sanders (MSFT)
    Friday, January 27, 2012 5:25 PM
    Moderator
  • I have tried 'Trigger Suspend' and suspend handler has been called. But app launched from "main metro screen" or Visual Studio didn't suspended in any case. May it be related to installation of the app through Visual Studio?

    Saturday, January 28, 2012 6:48 PM