Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Using UWP AppService with Qt



  • Hello all,

    I'm attempting to use the Windows Desktop Application Bridge to create a UWP app from an existing Win32 app. Stuffing an existing Win32 app in an appx and running it as a UWP app is easy enough. The problem I am running in to is that I need a protocol handler to be able to launch the UWP app from a web browser. This is proving to be a fair bit more difficult.

    From reading the available documentation, I have come to the conclusion that the "best" way to handle this situation is to peel the Win32 UI off my app and convert it to a background task, then create a UWP UI that calls to the background task to get the work done. It appears that the suggested way to handle this is using an AppService to handle communication between the two parts. That is where the problem shows up.

    According to all of the examples I can find, such as the ones at https://github.com/Microsoft/DesktopBridgeToUWP-Samples/tree/master/Samples/AppServiceBridgeSample_C%2B%2B, it seems that the way that the UWP app establishes a connection to the Win32 component is via the OnBackgroundActivated event that is part of the XAML Application class.

    Digging around in the Qt source, I can see that the qtmain_winrt.cpp file handles a lot of different events, but doesn't appear to handle the OnBackgroundActivated event. As a result, there doesn't appear to be any (obvious) way for my code to get that event, and use it to start listening on the AppService connection.

    Has anyone else managed to do something like this? Any pointers beyond hacking on the Qt source to add the missing event? (I'd rather not maintain a special branch of Qt along with the source for the app itself.)

    Thanks!


Log in to reply