All Questions
786 questions
0
votes
0
answers
18
views
Microsoft Store (Windows.Store.Services) How to handle and test parental authorisation for in-app purchases?
Using the C++/WinRT APIs for Microsoft Store apps (Windows.Store.Services), what is the flow for in-app purchases that require parental authorisation, and how do I test this?
Flow:
User attempts ...
1
vote
0
answers
98
views
Unable to deploy or run Microsoft Push Notifications sample
I'm trying to run the Microsoft Push Notifications sample taken from here client to explore this capability on a Windows app. My setup composed of Azure Notification server, remote app to trigger the ...
1
vote
1
answer
61
views
How to make a call once callback in C++winrt using smart pointers
I have to modify an existing Control using the Loaded event from a static member function that has to:
Not storing the revoker into some class member because the code is inside a static function. ...
1
vote
0
answers
62
views
How to install @nodert-win10-rs4/windows.devices.geolocation in Node 18 / Electron 29 with Cordova-Electron on Windows?
I’m working on a Cordova-Electron project where I need to access the Windows native geolocation API (WinRT) instead of using Google’s geolocation provider.
Environment details:
Node.js: 18.20.x
...
0
votes
0
answers
82
views
Consume a C# component with WinUI 3 controls from a WinRT/Win32 project
I followed this tutorial https://learn.microsoft.com/en-us/windows/apps/develop/platform/csharp-winrt/create-winrt-component-winui-cswinrt and I would like to do the same thing but from a Win32 ...
0
votes
1
answer
82
views
How do I winrt::make<>() a WinUI 3 Page?
So, I have a small snake game app built using WinUI 3 C++/WinRT, XAML workload in Visual Studio 2022 Version 17.14.8.
I ran into issues while creating a new instance of a runtime class of a XAML Page, ...
1
vote
1
answer
63
views
How to use WinAPi in a C++ WinRT Component?
I'm creating a C++ WinRT runtime component using Visual Studio 2022.
I want to use functions like PeekMessage() to handle a basic message loop. However, I get the following errors:
error C3861: '...
-1
votes
2
answers
75
views
How to initialize control from OnLaunched in C++/WinRT UWP app?
In Visual Studio I compiled the blank C++/WinRT UWP app which displays a button that says "Click me" and "Clicked" after it is clicked. As an experiment to learn how to initialize ...
0
votes
0
answers
143
views
Microsoft C++ exception: winrt::hresult_class_not_registered at memory location
I was trying the sample code from here
While trying to execute cpp-console-unpackaged sample of Push Notification, I am facing error:
Unhandled exception at 0x00007FFE067101DC in ConsoleApplication2....
2
votes
3
answers
200
views
How to show a ContentDialog before displaying any window?
I have a WinUi3 app written in C++.
I want to show a "MessageBox" before displaying the main window of the application (only sometimes, and based on some switch received in command line).
I ...
0
votes
0
answers
37
views
How to create a Clickable Image or Image Button in WinRT/C++
I actually struggle to find a way to make a Image clickable or generate a Image Button in XAMl. There is even no Documentation on how to generate a Simple Image Button.
Tried to find Image Button. ...
1
vote
1
answer
46
views
How is the Windows::Data::Xml::Dom GetNamedItemNS method used to return the value of an attribute?
Given XML that looks like this, I am trying to loop through the Bar elements, extracting the title attribute. Attempts to extract the title return NULL.
<?xml version="1.0" encoding="...
0
votes
0
answers
63
views
How to Process Low latency input in winui3 (WindowsAppSDK) like uwp
In my UWP project I am using CoreDispatcher.ProcessEvents function
like mentioned in https://github.com/microsoft/Windows-universal-samples/blob/main/Samples/LowLatencyInput/
I want to convert it for ...
0
votes
0
answers
46
views
Read audio frames using IBasicAudioEffect
ChatGPT told me:
Your audio effect class IBasicAudioEffect needs to be in separate component because Windows may need to instantiate it in a separate process
How can I callback to my main project ...
0
votes
0
answers
135
views
Where are these runtime startup/shutdown errors coming from using C++ WinRT/WinUI-3?
I have created a small C++ WinRT/WinUI-3 project to isolate the errors I've been experiencing. I start with a Blank App, Packaged (WinUI 3 in Desktop) using VS2022 V17.13.6 solution. Then I strip out ...
0
votes
1
answer
202
views
Issues with jsoncpp and C++/WinRT integration in Visual Studio 2022 – Compilation errors in allocator.h and base.h
I am working with Visual Studio 2022, and I am facing several issues when trying to integrate jsoncpp and C++/WinRT in my project. Here's the setup I'm using:
Package Management:
I installed jsoncpp ...
0
votes
1
answer
87
views
Can't get SelectedValue in WinUI 3 ComboBox to work
I tried this with String (hstring) combo items and everything worked fine. Now I try to use structure and... trying to fill ComboBox and select one of them.
ComboBox is filled ok, but no item is ...
0
votes
0
answers
114
views
Cannot create a Xaml UserControl in WinUI(3) WinRT/C++ Native Desktop App
I have created a minimalist WinUI(3) WinRT/C++ Desktop (Blank, Packaged) and added a single UserControl. The module that is added compiles and runs just fine. But I want to deal with ...
0
votes
1
answer
41
views
Windows runtime component project doesn't generate cpp and h skeletons
In Visual Studio 2022, there is a C++ Windows Runtime Component Project. I can use this, I suppose, to generate a skeleton given a Windows MIDL file. Then I go in and fill in the skeleton with my ...
1
vote
0
answers
64
views
NeighboringFilesQuery no longer works to launch Photos app with neighboring files
In Windows 10 the following code works to launch an image in the Windows Photo App, and provides access to other images in the folder via the NeighboringFilesQuery launch option (meaning you can use ...
0
votes
0
answers
316
views
How to create a Windows Application Packaging project for a C++WinRT UWP app?
I need to package a UWP app written with C++WinRT and a full trust win32 exe. I found no documentation about how to do this. The UWP C++WinRT project template only provides self-packaging with msix.
...
-1
votes
1
answer
54
views
Exception is thrown at requesting instance of winrt::Windows::UI::Shell::TaskbarManager::GetDefault()
I'm developing a qt5 windows 11 application and i want to be able to request to user to pin it to the taskbar, using winRT language projection i request and instance of the current taskbar and it ...
0
votes
1
answer
39
views
Can one use MKL with C++/WinRT?
I'd like to use Intel's Math Kernel Library (MKL) to do some calculations. I've figured this out for MFC programs, but I'm having trouble with C++/WinRT & WinUI 3 programs. For a repro, I took ...
0
votes
1
answer
119
views
How to bind to ComboBox.SelectedIndex using C++/WinRT and WinUI 3
I'm trying to bind an int to a ComboBox.SelectedIndex. Binding to a TextBox is trivial, but it appears that some extra plumbing is needed for the SelectedIndex. Here's the repro:
<!--MainWindow....
0
votes
1
answer
78
views
How to use `TextGetOptions` in `RichEditBox.TextDocument().GetText()` method with WinUI3 C++
I am using WinUI3 on C++ windows app. And I have to pass TextGetOptions to TextDocument().GetText() according to the document and visual studio intellisense.
void MainWindow::TextPreviewKeyDown(...
0
votes
0
answers
109
views
How can I use uwp or winRT in flutter?
I am trying to use "NetworkUsage" of Windows.Networking.Connectivity to get the network usage that the user used today, but flutter recently ended support for UWP.
So I tried to use ...
1
vote
1
answer
85
views
decoder.ptr was nullptr CreateDesktopWindowTarget - IDesktopWindowTarget [closed]
In C++, I want to load a image, and render it to a win32 window using winrt compositing. I'm just trying to build a simple test bed for my other app to test 2dtexture compositing.
I've tried many ...
2
votes
1
answer
732
views
Visual studio 2022 doesn't recognize winrt
Visual Studio 2022 doesn't detect any "#include <winrt/(various).h" headers.
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.UI.Xaml.h>
#include <winrt/...
0
votes
1
answer
112
views
GraphicsCaptureItem::CreateFromVisual but my input parameter is type Microsoft.UI.Composition.Visual instead of Windows
I'm migrating from UWP to WinUI3 and I'm trying to capture a screenshot of certain element in Xaml.
auto vis = ElementCompositionPreview::GetElementVisual(m_elementToCapture);
m_item = ...
1
vote
1
answer
208
views
How does the Windows Action Center get the name and icon of an application playing media?
I'm developing a library for easy integration of a media player with the action center playback. For this I used the known windows runtime interfaces ISystemMediaTransportControls and ...
0
votes
1
answer
64
views
winrt::hresult_class_not_registered - AudioEffectDefinition with custom effect
I'm trying to create a winrt custom audio effect using this tutorial.
#include "MyAudioEffect.g.h"
auto effectName = winrt::name_of<winrt::MRE_ClassNotRegistered::MyAudioEffect>();
...
0
votes
1
answer
427
views
C++ / winRT: Using the MediaPlayer API
I'm trying to use the MediaPlayer API in the most simple way. All I want to do is play back an audio file (and possibly get a notification when it's done).
Unfortunately, this forces me to use winRT ...
-1
votes
1
answer
394
views
Class Not Registered when communicating C++/WinRT with C#/WinRT components that return IAsyncOperation<> or IList<>
I'm currently facing an issue where i am unable to create a C#/WinRT component that returns any complex types acceptable by WinRT, like IAsyncOperation<>., IAsyncAction or IList<>.
I have ...
3
votes
1
answer
495
views
Can WindowsGraphicsCapture APIs capture child windows?
I need to capture the image of a specific window and save it as an array. I initially used BitBlt, which worked well except for windows with hardware acceleration (it seems to work for DirectX-...
0
votes
0
answers
212
views
WinRT prompt for MddBootstrapInitialize2 function suggests that this application cannot be started
I want the window to have a frosted glass effect, so I use windowsAppSdk in my win32 program. but when running into this code:
#include <Windows.h>
#include <MddBootstrap.h>
#include <...
0
votes
0
answers
103
views
How to utilize SetColor(Windows::UI::Colors::Red) from a Non-UWP and Non-C++/WinRT DLL file?
I have developed a C++ DLL without utilizing UWP or C++/WinRT. Within this DLL, I am employing Windows::Devices::Lights::LampArray^ lamp to retrieve information about the lamp, such as lamp->...
1
vote
1
answer
484
views
How to implement unit tests for WinUI3 (C++) application
At the moment, I have created a test project using a project template from Visual Studio Unit Test App (Winui 3) and my code looks like this
namespace TestMyWinrtApp
{
TEST_CLASS(CppUnitTests)
...
0
votes
1
answer
98
views
Unpackaged Desktop App: Binding to own dependency properties is not working
The demo project contains a simple GUI with a button and a derived user control MyUserControl.
MyUserControl only contains a border whose background is bound to the background of the user control:
...
0
votes
2
answers
467
views
FileOpenPicker "invalid window handle" exception
This is a follow-on question to Guarang Dave's question. With @Simon_Mourier's help, he figured it out, but I still haven't. I'm trying to do what ought to be a simple task: open a FileOpenPicker ...
0
votes
0
answers
151
views
C++/WinRT idiomatic way to dispose of smart pointer class fields
Say I have a basic WinRT class:
// midl
runtimeclass Class: IClosable
{
Class();
}
// .h
struct Class : ClassT<Class>
{
Class() = default;
void Close();
~Class();
private:
...
0
votes
0
answers
185
views
Acrylic does not work properly. Start the APP before turning on the transparency effect
1.Start the app after turning off the transparency effect in Windows 11 settings.
After launching the app and then turning on the transparency effect from Windows settings, Acrylic will not work ...
0
votes
0
answers
116
views
StoreContext.GetAppLicenseAsync returns no cached license when device is offline
This is a classic Win32 application distributed on MS Store.
At startup, it checks the status of the product license. See excerpt below (C++/WinRT):
#include <Windows.Foundation.h>
#include <...
0
votes
1
answer
197
views
Use `winrt.windows.media.control` in Node.js or Rust
In the following python code I get the currently playing media / music from windows.
To display it on a electron app i would prefer to get the data using Node.js (or Rust for Tauri):
import asyncio
...
1
vote
1
answer
279
views
Callback for monitoring the creating of files/folder and the changes in the files in Cloud Files API
In Cloud Files API, the platform invokes the respective callback function for the callback types.
there is a callback type for everything - reading, moving, deleting, renaming, list fetching - but I ...
0
votes
1
answer
150
views
IJsonValue.GetObject Method collides with windows.h macro
https://learn.microsoft.com/en-us/uwp/api/windows.data.json.ijsonvalue.getobject?view=winrt-22621
#include <winrt/Windows.Data.Json.h>
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <...
0
votes
0
answers
43
views
Im trying to read a file in cpp/clr and perform calculations on it and display it using GUI but Im getting errors Im not familair with
I am opening the file in binary mode and trying to get the first digit (number_of_poly) in the first row, the total number of rows, and the second digit (number_of_vars) in the second row, the total ...
0
votes
0
answers
204
views
How to use C++/WinRT API as part of C++ DLL without relying on the UWP UI portion?
I am attempting to utilize the C++/WinRT code provided in the sample of LampArray, cppwinrt to create a C++ DLL. However due to the tight coupling of this sample with the UI, I am not able to use ...
5
votes
0
answers
161
views
How to attach Nuget package.config file for C++ cmake project
I’m working on CPP WinUI3 desktop application with cmake. By default WinUI3 project uses MSBuild. We made the project use cmake with the help of this sample project. ref - https://github.com/...
1
vote
0
answers
172
views
Control, created with C++/WinRT Component, doesn't appear in C#/WinRT App
I want to use C++ as part of WinUI3.
I'm facing an issue where the C# component displays properly, but the C++ component doesn't.
Result
Therefore, I followed a Microsoft article to implement a C++/...
2
votes
1
answer
944
views
Use C++/WinRT component (but really any WinRT component) in WPF .NET 6
I would like to write a WPF application, but build it on modern frameworks as much as possible, including for example .NET 6 or maybe even higher.
I have some C++ code that I want to call, and I like ...