Get the Process id associated with given metro app package

回答済み Get the Process id associated with given metro app package

  • 2012年3月16日 15:52
     
     

    I want to get the process id of a running Metro app programatically via C++ code. What is the API to do that?

    I can't use EnumProcess since the running Metro App is run via WWAHost.exe, so I can't know which running WWAHost.exe is running my Metro App.

    • 移動 Rob CaplanMicrosoft Employee 2012年3月17日 5:48 Writing a desktop app, not writing a Metro style app (From:Building Metro style apps with C++ )
    •  

すべての返信

  • 2012年3月19日 7:43
    モデレータ
     
     

    Form this article: https://wiki.mozilla.org/Windows_8_Integration

    You will need to open the image in this part ["Process Exploration and Security"].

    You will see that we can find the information you wanted is in the "Command Line" column.

    So what we need to do is retrieve out the process command line information, and find the metro app name form there.

    http://www.codeproject.com/Articles/19685/Get-Process-Info-with-NtQueryInformationProcess 

    This article will give you this aspect help.

    Best wishes,


    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us

  • 2012年3月22日 14:01
     
     

    Hi Mike,

    Thanks for response. I tried getting the commandline, but the commandline is shown same for all the apps:
    "C:\Windows\system32\wwahost.exe" -ServerName:App.wwa

    Is this expected, or am I missing something? Is there any other way?

    To clarify, I am trying with an HTML/JS based metro app and not a native app. Could this make a difference?


    Also, In process explorer, I noticed that the Current directory of the WWAHost.exe process which is executing my Metro App is same as metro app install location. Could this be the differentiating factor between all the running app containers? If yes, what is the way to get current directory of another process?

    Thanks and regards,

    Japneet

    • 編集済み japneets 2012年3月22日 14:46
    • 編集済み japneets 2012年3月22日 14:55
    •  
  • 2012年3月23日 9:53
    モデレータ
     
     回答済み

    It seems that I have not noted that special case.

    But I found that the "Current Directory" also can give us the valuable information to identify the associate Process:

    Such as the "Weather" app in my Win8, and the following image is from the Procexp:


    Mike Zhang[MSFT]
    MSDN Community Support | Feedback to us

  • 2013年1月24日 19:32
     
     

    Do you know the function /API to retrieve that "Current Directory" information? I am stuck here as well since we are trying to develop a program to retrieve all the running  / suspended metro apps.

    thanks