Questions tagged [cppwinrt]

42 questions
9
votes
1 answer

Can C++ coroutines contain plain `return` statements?

I am writing a C++ coroutine for a UWP control using C++/WinRT: winrt::fire_and_forget MyControl::DoSomething() { if (/* some condition */) { // Why does this work?! return; } co_await…
citelao
  • 4,898
  • 2
  • 22
  • 36
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
2
votes
0 answers

Win2D effects in UI.Composition (C++)

Note: The goal is to create a window with an acrylic backdrop that can be drawn on by OpenGL. Any method that can achieve this is welcome. I have been able to successfully create a compositor per this tutorial. And intend to add a gaussian blur per…
AlephNot
  • 138
  • 7
2
votes
1 answer

How can I await multiple awaitables/IAsyncActions in C++/WinRT (`Promise.all` equivalent)?

Is there an equivalent to JavaScript's Promise.all in C++ or C++/WinRT for awaitables (or just Windows.Foundation.IAsyncAction)? For example, I am trying to gather multiple IAsyncActions and continue when all of them have completed. For now I'm…
citelao
  • 4,898
  • 2
  • 22
  • 36
2
votes
1 answer

Library includes WinRT brocken

I am trying to compile this project: https://github.com/bucienator/ble-win-cpp After cloning the repository, I got the error "wait_for" is not a member of "winrt :: impl". Using NuGet, I added the Microsoft.Windows.CppWinRT package to the project.…
xikov
  • 89
  • 8
1
vote
1 answer

WinUI3 : Handle network change event in WinUI3 desktop with c++

I'm working on the WinUI3 desktop application in C++. I was checking how we can get an event when the network to which system is connected to changes. I came across NetworkInformation.NetworkStatusChanged event. But I was not able to find any…
Harshith
  • 181
  • 2
  • 9
1
vote
3 answers

(IAsyncOperation for non WinRT types) Run coroutine task on Windows thread pool

I'm trying to provide co-routine support for non WinRT types that will asynchronously execute on the Windows thread pool. cppcoro and libunifex both provide the equivalent coroutine task type task. I imagine it would be a good idea to run these…
Tom Huntington
  • 2,260
  • 10
  • 20
1
vote
2 answers

How do I open a new Window in WinUI3 with WinRT/C++?

How do I open a new window in WinRT / WinUI3? I want to click a button and open up another floating window on top of the current / main window. I have tried code from several samples with zero…
rileyd
  • 56
  • 1
  • 5
1
vote
1 answer

AvSetMmThreadCharacteristicsW for UWP

I'm working on a WASAPI UWP audio application with cpp/winrt which needs to take audio from an input and send it to an output after being processed. I want to set my audio thread characteristics with AvSetMmThreadCharacteristicsW(L"Pro Audio",…
loics2
  • 616
  • 1
  • 10
  • 24
1
vote
1 answer

Calling a base class's protected constructor from a subclass does not work

I have a C++/WinRT base class that I need to subclass. My problem is that I don't manage to call the base class's protected constructor from the subclass. That base class is defined in MIDL as follows: namespace My.Custom.WindowsRuntimeComponent { …
ackh
  • 1,648
  • 2
  • 18
  • 36
1
vote
1 answer

C++/WinRT natvis doesn't work in fresh install

How can I trouble-shoot this? I combined the natvis example in this question with the C++/WinRT console template and succeeded in getting the natvis for the Matrix2d to work but not for the Uri. #include "pch.h" using namespace winrt; using…
Tom Huntington
  • 2,260
  • 10
  • 20
1
vote
1 answer

Error while implementing a windows runtime interface for local consumption while porting from c++/cx to c++/winrt

Update: Based on Ryan Shepherd's reply, I changed my code to: class DerivedClass : winrt::implements { public: DerivedClass(winrt::FrameworkElement& control) : 5===>implements_type(control) {} static…
ssn
  • 2,631
  • 4
  • 24
  • 28
1
vote
1 answer

Problems with midl.exe and cppwinrt.exe from CMake

This is somewhat of a follow-on to How to use midlrt.exe to compile .idl to .winmd? I have this in my CMakeLists.txt . My questions are less about the CMake logic and more about the output of the midl and cppwinrt commands, and subsequent errors in…
Theodore Hall
  • 91
  • 1
  • 6
1
vote
1 answer

Getting system language UWP C++/WinRT

I wanted to get the system language (not the input language, but the overall system language) in the C++/WinRT app, but can't find a way for doing such. I googled and found that in Unity this can be done using…
arsdever
  • 1,111
  • 1
  • 11
  • 32
1
vote
1 answer

Error related to headers and namespaces when migrating from C++/CX to C++/WinRT

File.h: std::map someMap; File.cpp auto it = someMap.find(someKey); if (it != someMap.end()) { it.second += (winrt::hstring{L", "} + someString.c_str()); } I get the following error: 'second': is not a member of…
ssn
  • 2,631
  • 4
  • 24
  • 28
1
2 3