locked
Receiving the OnFileActivated, OnActivated, and OnLaunched notifications.

    Question

  • It appears that your app has to be a xaml C++ to override these.  Is that the case?  If not please point me in the right direction.
    Sunday, December 11, 2011 8:25 PM

Answers

  • Only Xaml apps can handle events from Windows.Ui.Xaml, yes.  A DirectX app will need to get this at a lower level from the CoreApplication events.  Take a look at the DX samples for examples of this.

    --Rob

    Monday, December 12, 2011 5:39 AM
    Owner
  • Exactly.  Windows.UI.Xaml synthesizes the other events from the Activated event's Kind.

    --Rob

    Wednesday, December 14, 2011 3:56 AM
    Owner

All replies

  • Only Xaml apps can handle events from Windows.Ui.Xaml, yes.  A DirectX app will need to get this at a lower level from the CoreApplication events.  Take a look at the DX samples for examples of this.

    --Rob

    Monday, December 12, 2011 5:39 AM
    Owner
  • So all I see at that level from the CoreApplication Exiting, and Resuming which take no arguments, then Suspending.  The CoreApplicationView only offers activated. The CoreWindow only offers activated.

    If you could even offer up a specific entry point to tap into for the OnActivated notification that would be wonderful.


    Monday, December 12, 2011 3:55 PM
  • So all I can seemingly patch is the view:::Activated event which only sends a IActivatedEventArgs.  Do I simply test the Kind field and then cast to the proper args..

    for instance with Kind == ActivationKind::Launchforce the IActivatedEventArgsto be a LaunchActivatedEventArgs?

    Monday, December 12, 2011 5:29 PM
  • Exactly.  Windows.UI.Xaml synthesizes the other events from the Activated event's Kind.

    --Rob

    Wednesday, December 14, 2011 3:56 AM
    Owner
  • How do you get the same mechanic in a C++ application? The only event type I get from the Activated event is a WindowActivatedEventArgs and not a IActivatedEventArgs... so I don't have access to the "kind" field.  WindowActivatedEventArgs only contains a state, which isn't useful to rebuild the OnFileActivated event.

    I have the same issue as you, I need to be able to receive the OnFileActivated event in a Metro DirectX application that is not XAML based, but I'm in C++ which seems to be different from the Java one...

    I've browsed a full day trying to find samples or info about this, nothing! At least, no examples in C++...

    Sunday, January 29, 2012 1:53 PM
  • Hi Robert,

    This entire conversation is about how to capture these events in C++ without Xaml.

    Your app needs to sink the CoreApplicationView::Activated event. This will be passed the IActivatedEventArgs with the Kind. You can see this demonstrated in the Direct3D 11.1 Simple Stereo 3D sample: put a breakpoint on View::Initialize (where it is set) and View::OnActivated (where it is handled).

    --Rob

    Tuesday, January 31, 2012 3:41 AM
    Owner
  • Nevermind my comment, I wasn't updated with the latest Developer Preview software and the interface was different. Now that I upgraded everything is correct and I do receive the IActivatedEventArgs successfully. Thanks.
    Thursday, February 2, 2012 10:44 PM