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
7
votes
1 answer

Any recommendation in using smart pointers for COM-lite objects in C++/WinRT component?

C++/WinRT provides 3 flavors of smart pointers to use for COM objects - Microsoft::WRL::ComPtr, com_ptr, and ATL-based CComPtr. In my case, it is a COM-lite object, meaning it is NOT an in-proc or out-of-proc COM object, it is created as a C++…
Snekithan
  • 360
  • 3
  • 11
6
votes
0 answers

Cant load WinRT/C++ component to my UWP/C# application

I need to wrap WebRTC c++ library into WinRT component and use it from my UWP/C# application. There is a good article how to use native c++ in uwp which describes all the integration steps, which I followed. Briefly: I have created Dll/C++ DLL1…
Neil Galiaskarov
  • 5,015
  • 2
  • 27
  • 46
5
votes
1 answer

Consuming C++/WinRT Components from C#

I have a project (dynamic library) written in C++/CX, this project is consumed by a Windows 10 Universal App written in C# (targeting x86 and ARM32). I want to rewrite the library to C++/WinRT in order to use vanilla C++. Q1: Is it possible to…
Tim Hansson
  • 309
  • 2
  • 16
4
votes
3 answers

BLE Using WinRT: Access Denied When Executing "GetCharacteristicsForUuidAsync()" for Write Characteristic

Maybe someone can help me out because I have a really tricky situation with Bluetooth LE using WinRT on Windows 10 (like supposed here: Bluetooth Low Energy in .Net (C#)). I need BLE within a Win32 classic desktop application. Our code is running in…
4
votes
2 answers

How to free memory of c++ WinRT value structs

Do I have to, and how do I, free memory from a value struct created in a Windows Runtime Component that has been returned to a managed C# project? I declared the struct // Custom struct public value struct PlayerData { Platform::String^ Name; …
Toine db
  • 709
  • 7
  • 25
4
votes
2 answers

Convert Platform::String to std::string

I am getting String^ which Contains some Indian language characters in a callback from C# Component in my C++ WinRT Component in a Cocos2dx game for Windows Phone 8 project. Whenever I convert it to std::string the Hindi and other characters turn in…
Vikas Patidar
  • 42,865
  • 22
  • 93
  • 106
4
votes
1 answer

MapControl differentiate between user or programmatic center change

In the WinRt/WP 8.1 MapControl, how do I differentiate between when the user changed the center of the screen by swiping vs a programmatic change? The WinRt/WP 8.1 MapControl has a CenterChanged event (…
4
votes
1 answer

Toast notification & Geofence Windows Phone 8.1

I'm facing a strange problem with my Windows Phone 8.1 App. The App will send a toast notification every time the user is near a Point of his interest using Geofence Quickstart: Setting up a geofence and BackgroundTask Quickstart: Listening for…
Valerio
  • 278
  • 1
  • 6
  • 18
4
votes
1 answer

Pattern for an async method that returns something immediately

If I write a simple function I can get a result immediately. If I use async/await and return a Task - the method will kinda return when it's done with the task, but what if I need to write a method that needs to return immediately, but then continue…
Filip Skakun
  • 31,624
  • 6
  • 74
  • 100
3
votes
1 answer

How to use midlrt.exe to compile .idl to .winmd?

Background: I need to build a Windows Runtime Component as part of a system that's set up to use CMake to generate its build system. As a preparatory step I'm trying to build it on the command line. Starting with a bare-bones .idl file…
IInspectable
  • 46,945
  • 8
  • 85
  • 181
3
votes
1 answer

What is a composable runtime class?

I'm experimenting with creating a simple xaml appilcation using C++/WinRT. I come from a WPF background where it is pretty common to have a base class that implements INotifyPropertyChanged and have other classes inherit from it. When I try to do…
Elad Maimoni
  • 3,703
  • 3
  • 20
  • 37
3
votes
1 answer

How should an async callback in a WinRT object be implemented?

So far I could make a delegate type, for example: // Can't use Task in WinRT interface and TypedEventHandler doesn't work with async await public delegate IAsyncOperation AsyncEventHandler(object sender, object args); And then expose in…
Johnny Haddock
  • 415
  • 3
  • 11
3
votes
2 answers

Is it possible to get resource based on target type in WinRT platform

In WPF we can able to get the style based on the target type, like below: control.Style = (Style)toplevelcontrol.TryFindResource(typeof(control)) But in WinRT I can't do that. I can only use a key to get the resource. Is it possible to get the…
SharpGobi
  • 144
  • 1
  • 13
3
votes
1 answer

Is It Possible to Use IGetActivationFactory.GetActivationFactory in C#?

I am learning WinRT and have found this interface: https://msdn.microsoft.com/en-us/library/windows.foundation.igetactivationfactory.aspx However, all of the samples that I have seen (example here) are in C++. Is it possible to access this method…
Mike-E
  • 2,477
  • 3
  • 22
  • 34
3
votes
2 answers

What is the message dialog "Search for app in the Store?" in Windows Phone 8.1 WebView

I'm applying a WebView made for android and ios to Windows Phone 8.1. But in the Windows Phone 8.1, a weird message dialog is launched everytime I navigate a page. What html code cause this? I want the dialog not to launch.
1
2 3 4 5 6 7 8