/// <summary> /// Launch an UWB application. You can use the family name as well as the full name. /// if there are more options for full name, it will prefer the version that corresponds to the architecture /// e.g. the X64 version on X64 machines /// </summary> /// <param name="packageName">Family name or full name of the package</param> public AppLauncher(string packageName) { try { _packageInfo = null; var error = NativeMethods.OpenPackageInfoByFullName(packageName, 0, out _packageInfo); if (error != NoError) { FullName = GetFullName(packageName); error = NativeMethods.OpenPackageInfoByFullName(FullName, 0, out _packageInfo); } Debug.Assert(error == NoError || error == ErrorNotFound, "error is " + error.ToString(InvariantCulture)); } catch (EntryPointNotFoundException) { // we are not on a platform that supports Apps. _packageInfo is already IntPtr.Zero. } }
public static extern int OpenPackageInfoByFullName([MarshalAs(UnmanagedType.LPWStr)] string fullName, uint reserved, out SafeAppHandle packageInfo);
public static extern int GetPackageApplicationIds(SafeAppHandle pir, ref int bufferLength, byte[] buffer, out int count);