Questions tagged [winrt-component]

Windows Runtime Component and WinRT Component Libraries are concepts related to language runtime interoperability in Windows Runtime - the modern development platform for Windows and typically used in Windows Store applications. Use this tag to denote any questions related to creating WinRT Components, WinRT Component Libraries and typically to limitations imposed by the rules of creating WinRT Components.

From Wikipedia:

Classes that are compiled to target the WinRT are called WinRT components. They are classes that can be written in any supported language and for any supported platform. The key is the metadata. This metadata makes it possible to interface with the component from any other WinRT language. The runtime requires WinRT components that are built with .NET Framework to use the defined interface types or .NET type interfaces, which automatically map to the first named. Inheritance is as yet not supported in managed WinRT components, except for XAML classes.

Windows Runtime applications can be written using any combinations of the three major runtimes - native, .NET and JS as long as these components are exposed across ABI (application binary interface) following rules such as - public classes need to be sealed, method arguments and return types need to be WinRT types themselves or have direct projection to those (such as Windows.Foundation.Uri with System.Uri or Platform::String and System.String or many of the other basic types having counterparts in different language runtimes).

114 questions
1
vote
0 answers

How can I project a templated C++ API to WinRT via c++/winrt?

I have a pre-existing native C++ library I am trying to expose to UWP applications by projecting the API through a C++/WinRT Runtime Component. I am having difficulty understanding how to expose templated functions. For the following example C++…
Sean Kelly
  • 338
  • 1
  • 10
1
vote
1 answer

Out-out-process WinRT component + runFullTrust?

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…
1
vote
1 answer

How to get rid of too many arguments warning C4002 in cppwinrt header file

I am getting a too many arguments warning in the following situation. I can report it as a bug but the repository in GitHub is closed and the cpp-winrt project is now owned by Microsoft. The situation Create a new windows runtime component…
vikas pachisia
  • 553
  • 5
  • 8
1
vote
1 answer

InvalidCastException when calling wrt/c++ Windows Runtime Component from UWP Application C# project

I have a small solution that contains two projects: a UWP App (C#) a Windows Runtime Component (C++/WinRT) that is referenced by the App. The C++/WinRT component contains a class D3DPanel that is derived from…
1
vote
0 answers

Accessing UI thread from Windows Runtime Component throws exception only on Mobile

I have the following problem. I am using a simple Windows Runtime Component to communicate between the application and a WebView. I am doing this according to documentation This is the code for the Windows Runtime Component public delegate void…
Corcus
  • 1,070
  • 7
  • 25
1
vote
1 answer

UWP Brokered Windows Runtime Component Build error

I Created a simple .Net class library using VS2017 and windows 10 and changed the output type to winmdobj as stated in this msdn…
1
vote
2 answers

Delphi - Making asynchronous calls to WinRT API using TTask.Future

Related to this question, I am trying to implement a procedure that uses the WinRT API to set the desktop wallpaper. To mimic the await functionality in C#, I am using TTask.Future (link) as outlined here and here. My implementation looks like…
1
vote
0 answers

How to distinguish in WinRT component Windows or Windows phone environment?

I have a Windows Universal app for Windows/WinPhone 8.1 which uses WinRT runtime components for background processing. There is a small difference between Win and WP versions in background processing, so I'd like to take this into account. Yet WinRT…
Tertium
  • 6,049
  • 3
  • 30
  • 51
1
vote
1 answer

Get Windows 8.1 universal app state / public variable access from its winrt component

I have an Universal Windows Platform app and for background checkings I use winrt component (separate project in solution). I register it correctly and system launches my winrt class every 15 minutes. The problem is that my app uses the same files…
1
vote
1 answer

Not able to use WinRT Libraries in my Visual basics 2010 C# project

So, I've been trying to get access To PackageManager class from namespace Windows.Management.Deployment from Windows Runtime which is used to fetch the details of Metro Apps installed in the system. Its been told that using WinRT libraries for the…
1
vote
0 answers

UWP Javascript WinRTError: TypeInitialization_Type_NoTypeAvailable

When I enable true in *.jsproj file, then one of the Universal component throws this error, without much details. WinRTError: The text associated with this error code could not be found. …
1
vote
1 answer

How to free memory of c++ WinRT classes created in the runtime component

Do I have to, and how can I, free memory from a class created in a Windows Runtime Component that has been returned to a managed C# project? This question concerns Classes instead of structs like How to free memory of c++ WinRT value structs The…
Toine db
  • 709
  • 7
  • 25
1
vote
0 answers

Custom attached properties in Windows Runtime Components?

I'm trying to use the c# class library https://github.com/MacawNL/WinRT-RichTextBlock.Html2Xaml in a C++ UWP project. To my limited knowledge, I have to build the project as a Windows Runtime Component instead of a class library to use it with…
1
vote
2 answers

Converting between WinRT HttpBufferContent and unmanaged memory in C++cx

As part of a WinRT C++cx component, what's the most efficient way to convert an unmanaged buffer of bytes (say expressed as a std::string) back and forth with a Windows::Web::Http::HttpBufferContent? This is what I ended up with, but it doesn't seem…
Pol
  • 3,848
  • 1
  • 38
  • 55
1
vote
2 answers

Equivalent of the GetTempPath on Windows Phone

I am compiling a third party library libkml for Windows Universal App. And I notice that the following Win32 API is not available on anything but WINAPI_PARTITION_DESKTOP. The following is from fileapi.h: #if…
Yuchen
  • 30,852
  • 26
  • 164
  • 234