How to get the name of the running HTML application Windows 8 (and not WWHOST)

I am trying to get the name of a Windows 8 application working with this ProcessID. I can get wwahost, this is the real name of the process that is running, but I want to get the name of the application that WWHOST really works.

I saw this topic http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/c9665bf4-00e4-476c-badb-37126efd3f4b/ with this discussion, but there is no specific answer.

any ideas?

+4
source share
2 answers

Do you want to call GetApplicationUserModelId

The attached application allows you to pass the PID and get information about the application. For instance:

C:\src\GetAppInfo\Debug>GetAppInfo.exe 7400 Process 7400 (handle=00000044) Microsoft.BingWeather_8wekyb3d8bbwe!App 

To go to C #,

  const int QueryLimitedInformation = 0x1000; const int ERROR_INSUFFICIENT_BUFFER = 0x7a; const int ERROR_SUCCESS = 0x0; [DllImport("kernel32.dll")] internal static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId); [DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr hHandle); [DllImport("kernel32.dll")] internal static extern Int32 GetApplicationUserModelId( IntPtr hProcess, ref UInt32 AppModelIDLength, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder sbAppUserModelID); 

Then your code should look something like this:

  if (sProcessName.ToLower().Contains("wwahost") && ((Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor > 1))) { IntPtr ptrProcess = OpenProcess(QueryLimitedInformation, false, iPID); if (IntPtr.Zero != ptrProcess) { uint cchLen = 130; // Currently APPLICATION_USER_MODEL_ID_MAX_LENGTH = 130 StringBuilder sbName = new StringBuilder((int)cchLen); Int32 lResult = GetApplicationUserModelId(ptrProcess, ref cchLen, sbName); if (ERROR_SUCCESS == lResult) { sResult = sbName.ToString(); } else if (ERROR_INSUFFICIENT_BUFFER == lResult) { sbName = new StringBuilder((int)cchLen); if (ERROR_SUCCESS == GetApplicationUserModelId(ptrProcess, ref cchLen, sbName)) { sResult = sbName.ToString(); } } CloseHandle(ptrProcess); } } 
+2
source

Look Get the name of an executable assembly from a reference DLL in C #

You can look around Assembly.GetEntryAssembly () or Assembly.GetExecutingAssembly (), for example.

 string exeAssemblyName = Assembly.GetEntryAssembly().GetName().Name; 
-1
source

Source: https://habr.com/ru/post/1485425/


All Articles