locked
Is there a way to actually Kill and Not Suspend a Metro App

    Question

  • I work for a company that is trying to automate tests, and we need a methodology in which we can actually close or Kill a Metro App. 

    I have been told that MetroApps are actually threads running under the Mtro UI .  In windows 7 there is a way to enumerate these threads, and based on the Thread ID , Tell the Windows 7 System to Close Down this thread ID.  Is there such a way in the Metro, or Win 8 API ?

    Will TaskKill be able to find the MetroUI Process, and Kill it, and will the Metro UI be able to Recover form this aciton ?

    I have developed on Windows XP, .NET, and Windows 7 but Windows 8 is completely new so That is where I am coming from.

    Any Help would be appreciated

    Wednesday, April 4, 2012 5:37 PM

Answers

  • Hi,

    There is no way to kill a Metro style app programmatically.

    Users can choose to close an app using the close gesture or by pressing Alt+F4. You can't include any UI in your app to enable the user to close your app.

    Otherwise, TerminateProcess and ExirProcess APIs are not available for Metro style app.

    Please refer to Application lifecycle for more details.


    Best wishes,


    Robin [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, April 5, 2012 9:10 AM
    Moderator
  • Hi MicroImage,

    What you were told is incorrect. Metro style apps all run in their own processes, not as separate threads of a monolithic host process. You can kill a Metro style app with TaskKill.

    What might have been intended is that Metro style apps written in HTML/JavaScript will all run in WWAHost.exe processes, but they will each have their own one. The tricky part will be to find the right process, but you can locate the PID in TaskManager (although if you do that you might as well kill it from there as well). Metro style apps written in C# or C++ will have their own .exe names.

    --Rob

    Friday, April 6, 2012 12:30 AM
    Owner

All replies

  • Hi,

    There is no way to kill a Metro style app programmatically.

    Users can choose to close an app using the close gesture or by pressing Alt+F4. You can't include any UI in your app to enable the user to close your app.

    Otherwise, TerminateProcess and ExirProcess APIs are not available for Metro style app.

    Please refer to Application lifecycle for more details.


    Best wishes,


    Robin [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, April 5, 2012 9:10 AM
    Moderator
  • Hi MicroImage,

    What you were told is incorrect. Metro style apps all run in their own processes, not as separate threads of a monolithic host process. You can kill a Metro style app with TaskKill.

    What might have been intended is that Metro style apps written in HTML/JavaScript will all run in WWAHost.exe processes, but they will each have their own one. The tricky part will be to find the right process, but you can locate the PID in TaskManager (although if you do that you might as well kill it from there as well). Metro style apps written in C# or C++ will have their own .exe names.

    --Rob

    Friday, April 6, 2012 12:30 AM
    Owner