Nick's .NET Travels

Continually looking for the yellow brick road so I can catch me a wizard....

Launching Windows Store Applications from Code in Windows 10

On Windows 8/8.1 after installing an application from the Windows Store it was possible to interrogate the registry and find the AppUserModelId which could then be used to launch the application. This process is described in more detail here - http://www.codeproject.com/Articles/542316/Run-Windows-Store-Apps-From-Desktop.

There are a couple of ways to launch the application using the AppUserModelId:

- The first (as the link suggests) is to use the launcher utility that comes with the SDK eg:
C:\Program Files (x86)\Windows Kits\8.0\App Certification Kit\Microsoft.Windows.SoftwareLogo.AppxLauncher.exe “AppUserModelId

- The other way is to use the ApplicationActivationManager (https://msdn.microsoft.com/en-us/library/windows/desktop/hh706902(v=vs.85).aspx) which can be used as follows:

uint pid;
var mgr = new ApplicationActivationManager();
mgr.ActivateApplication("[AppUserModelId]", null, ActivateOptions.None, out pid);

This technique relies on getting the AppUserModelId from the following Registry:

HKEY_CURRENT_USER\Software\Classes\ActivatableClasses\Package\**PackageFullName**\Server

The installation process for Store applications on Windows 10 doesn't create this Registry key, which means we need another way to determine the AppUserModelId. I haven't found a definitive way to do this but I did manage to find a way which seems to work. Essentially you need to append "!App" to the package family name of your application (not the package full name).

If you haven't played around with the powershell commands for installing and querying installed packages, it's worth taking a look. For example to get a list of all packages for a particular publisher you can issue the following powershell command:

get-appxpackage -publisher "OID.0.9.2342.19200300.100.1.1=6434210, CN=Built to Roam Pty Ltd, OU=Built to Roam Pty Ltd"

This will return a listing for each application such as the following:

Which, as you can see contains the PackageFamilyName - add "!App" and you have a string that should work as the AppUserModelId, allowing you to launch the application from code.



Pingbacks and trackbacks (2)+

Comments are closed