Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Localized Names of Installed Windows Store Apps in Windows 8

I want to populate a ListBox with the localized display names of all the installed Windows Store apps in a Windows 8 desktop app. I tried this:

string Apps = Interaction.Environ("ProgramFiles") + "\\WindowsApps";
foreach ( App in IO.Directory.GetDirectories(Apps)) {
            XmlDocument xml = new XmlDocument();
            xml.LoadXml(My.Computer.FileSystem.ReadAllText(App + "\\AppxManifest.xml"));
            lbApps.Items.Add(xml.GetElementsByTagName("DisplayName")(0).InnerText);
 }

But it adds up ms-resource strings and default apps that are uninstalled.

EDIT: I found that all the installed apps have their shortcuts in %LocalAppData%\Microsoft\Windows\Application Shortcuts but those shortcuts don't have the localized name and are non-functional when opened.

like image 630
Elmo Avatar asked Nov 14 '12 15:11

Elmo


1 Answers

Instead of parsing the AppxManifest files directly, use the PackageManager class.

On MSDN, there are quite a few samples that demonstrate how to gather a variety of content about installed application packages, including the Enumerate app packages by user SID sample.

like image 98
Nathan Kuchta Avatar answered Oct 01 '22 14:10

Nathan Kuchta