Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Launch apps from microsoft store on win10

Launch apps from microsoft store on win10

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 239 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KaviLin
    wrote on last edited by
    #1

    I want to make a feature obtain all apps installed in pc and users can launch other apps from my apps.
    Here is the problem I meet,

    There're some applications already pre-load in win10 ( or install from Microsoft store,
    for example: paint3D, weather..etc)
    and they all installed in a folder that the user needs permission to access this folder:

    "C:\Program Files\WindowsApps"

    It means if I want to launch apps inside this folder, I must launch it through shell script just like:

    "explorer.exe shell:appsFolder\Microsoft.BingWeather_8wekyb3d8bbwe!App"

    It composed by "PackageFamilyName" ! "app ID"
    but It is lots of work to get this two information from windows.

    Is there have a more convenient way to launch this kind of app by QT?
    thanks!

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      Hi, you can bypass finding the package and app ID by utilizing that MSStore apps also register themselves via a windows.protocol (a string that ends with :// like https:// etc.)
      Here's an suggestion on how to enumerate them from the registry and then start them using the "://" suffix:

      Create an empty, vanilla Widgets app, then change your main.cpp to look like this:

      #include "mainwindow.h"
      #include <QApplication>
      
      #include "qsettings.h"
      #include "qcombobox.h"
      #include "qpushbutton.h"
      #include "qprocess.h"
      #include "QVBoxLayout"
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          QSettings r("HKEY_CLASSES_ROOT\\Local Settings\\Software\\Microsoft\\Windows\\CurrentVersion\\AppModel\\PackageRepository\\Extensions\\windows.protocol",QSettings::NativeFormat);
      
          auto cb = new QComboBox;;
          cb->setEditable(false);
          cb->addItems(r.childGroups());
          auto pb = new QPushButton;
          QObject::connect(pb,&QPushButton::clicked,[cb] {  QProcess::startDetached("explorer " + cb->currentText() + "://"); });
      
          auto vb = new QVBoxLayout;
          vb->addWidget(cb);
          vb->addWidget(pb);
          auto wi= new QWidget;
          wi->setLayout(vb);
          wi->show();
      
          return a.exec();
      }
      

      To start for example Calculator, just scroll down to "calculator" in the combobox and press the button, voila :-)

      1 Reply Last reply
      4

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved