How to Call Metro API with Win32 Application?


  • How to  Call Metro API with Win32 Application?

    I Create a Win32 Application, I want to call "::Window::UI::Popups::MessageDialog(L"123",L"Info")->ShowAsync()->Start();", What should I do?

    "C:\Windows\System32\DisplaySwitch.exe" is Metro App or Win32 App?


    Monday, November 14, 2011 8:41 AM


All replies

    • Proposed as answer by Amare1982 Monday, April 23, 2012 4:27 AM
    Monday, November 14, 2011 1:10 PM
  • How do I use?
    Tuesday, November 15, 2011 1:55 AM
  • Windows::UI::Popups::MessageDialog requires a CoreWindow and cannot be reasonably called from a Desktop app.

    From a Desktop app, use a TaskDialog .


    Tuesday, November 15, 2011 5:22 AM
  • Thank you Rob Caplan for the clear, concise response.

    "...cannot be reasonably called from a Desktop app."

    1) Can a Desktop app obtain a reference to a Core window so the app could use a Windows::UI::Popups::MessageDialog - even if the code is unreasonably complex?

    2) Isn't the Desktop itself a Metro app and therefore has a CoreWindow? / Can a Desktop app obtain the CoreWindow of the Dekstop and pass it to the MessageDialog?

    Motivation for my questions: I seek a way to notify a user who is focused on the Metro screen, from my Desktop app.  Of the two UI elements available for alerting on the Metro screen (ToastNotifier or MessageDialog), the MessageDialog is more user-friendly. However, only ToastNotifier is usable in a Desktop app, as documentation shows MessageDialog is not. I hope the preliminary documentation missed something; that MessageDialog might be usable from a DT app.

    Thanks and pardon the long question from this newbie to the forum.

    • Edited by SeanMedina Thursday, April 26, 2012 1:51 AM
    Wednesday, April 25, 2012 11:44 PM