locked
Transfer Protocol RRS feed

  • Question

  • Hi.

    I'm trying to implement MediaTransferControls in our desktop application. I know how to create ISystemMediaTransportControlsInterop instance and using GetForWindow method get ISystemMediaTransportControls. Only problem i have is how can i set button pressed event ? How can i create '__FITypedEventHandler_2_Windows__CMedia__CSystemMediaTransportControls_Windows__CMedia__CSystemMediaTransportControlsButtonPressedEventArgs' which is first parameter ?

    Regards.

    Thursday, April 20, 2017 8:32 PM

Answers

  • I've found a solution. So for somebody who has same issue:

    g_token = new EventRegistrationToken();
    ComPtr<ITypedEventHandler<ABI::Windows::Media::SystemMediaTransportControls*, ABI::Windows::Media::SystemMediaTransportControlsButtonPressedEventArgs*>> handler;
    handler = Callback<ITypedEventHandler<ABI::Windows::Media::SystemMediaTransportControls*, ABI::Windows::Media::SystemMediaTransportControlsButtonPressedEventArgs*> >
          (std::bind(
            &CMyClass::ButtonPressed,
            this,
            placeholders::_1,
            placeholders::_2
          ));
    
    m_mediaControls->add_ButtonPressed(handler.Get(), g_token);
    

    Friday, April 21, 2017 7:27 AM