1

I'm working on a UWP app (C++/WinRT) that must communicate extensively with a background process. Unfortunately, the background process must remain a full trust "Win32" process. Both are packaged in an MSIX.

For performance and programmability reasons, my first choice would be to turn the background process into an out-of-process WinRT component. App Services is a possibility but not ideal.

I've found numerous code samples for creating an OOP WinRT component via WRL. However, activation is performed via CoreApplication::RunWithActivationFactories(), which (as far as I know) requires an AppContainer.

I know I can consume a WinRT component in a Win32 process. Can I create one? If so, what would activation look like in C++/WinRT?

Kevin Richardson
  • 3,592
  • 22
  • 14

1 Answers1

0

Yes, from the Windows 10 Version 1903, May 2019 Update, the windows have added support for non-packaged desktop apps to make use of user-defined (3rd party) Windows Runtime (WinRT) Components, which means that we can consume a Winrt component from the Win32 process directly. To successfully reference a C++ Windows Runtime component from a Win32 app, you need to use C++/WinRT to generate projection header files of your component. You can then include these header files in your app code to call your component.

For the detailed information, please refer to this article:

https://blogs.windows.com/windowsdeveloper/2019/04/30/enhancing-non-packaged-desktop-apps-using-windows-runtime-components/.

For the detailed sample, please refer to here:

https://github.com/microsoft/RegFree_WinRT/tree/master/Cpp.

Thanks.

Amy Peng - MSFT
  • 1,902
  • 11
  • 14
  • I’m not trying to use a WinRT component from an unpackaged app. I’m asking about creating/activating an out-of-process WinRT component that is deployed in an MSIX but doesn’t run in an AppContainer. – Kevin Richardson Oct 22 '19 at 06:49
  • @kevin, Out-of-process WinRT components are supported outside of the OS, but currently it has some Library/Tooling limitations. Please check this C++/Winrt sample:https://github.com/kennykerr/oop for activation. Besides, I was told that you have already figured it out, please feel free to share it out to benefit more community memebers.Thank you. – Amy Peng - MSFT Nov 04 '19 at 14:32