728 questions
0
votes
0
answers
15
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
48
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
56
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
40
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
45
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
92
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
81
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
149
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
0
answers
39
views
Mouse Mode in C++WinRT?
I am trying to enable mouse mode on the root Page element in a Blank App (C++/WinRT) project. I have an Xbox 1 controller attached to a Xbox 1 usb dongle. So far I have coded a small xaml file with a ...
0
votes
1
answer
38
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
0
answers
53
views
Generate include files for Microsoft.WindowsAppSDK with cppwinrt in CMake library project
For an attempt to provide activation feature for a Flutter plugin I try to integrate Microsoft.WindowsAppSDK which is needed to get the required extensions.
Microsoft.Windows.ImplementationLibrary and ...
0
votes
1
answer
170
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
120
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
0
answers
305
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
110
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
100
views
C++/WinRT RequestAsync memory leak
I'm trying to figure out the cause of a memory leak in the following program. Running it causes memory usage to increase from 2MB -> 5MB (as reported by Visual Studio diagnostic tools) in about ...
0
votes
0
answers
95
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
273
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
93
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
0
answers
90
views
CAtlServiceModuleT and CoInitializeSecurity: what to set?
We have a service created with CAtlServiceModuleT hosting one single COM coclass. The documents doesn't really tell much, but by experiment I found out that in order to allow non-elevated processes to ...
0
votes
2
answers
247
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
102
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
122
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
91
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
117
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
194
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
79
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
38
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
168
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
109
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
123
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
515
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 ...
0
votes
1
answer
142
views
Which Windows API can be used to make transparent text on top of the screen?
I'd like to display text at the bottom right corner of a Windows computer (the Task Bar is hidden). I'd like the text to be visible but no background.
What is the correct Windows API to do this with?
...
-2
votes
1
answer
141
views
'The specified module could not be found. after adding c++ dll in WinRt component and using WinRt in UWP
I have created a c++ library then added this to the WinRt successfully, setting all the linker input directory, the header file directory in visual studio for WinRt, and and referencing this winrt ....
0
votes
1
answer
104
views
Printing a PDF File Silently in a WinRT App using C++ without Displaying any Window
I am developing a WinRT application for Windows using C++. I have the path to a PDF file (stored on disk) and the name of the printer. My goal is to print this PDF file programmatically (silently) ...
0
votes
0
answers
89
views
UWP Blank app throws error code: The app didn't start.. Activation phase: COM ActivateExtension
I'm trying to integrate a existing DLL project (3rd party dependencies) to Blank UWP. The Blank App project build fine but throws error when it is lauched.
In Event Viewer, log suggests Error code: ...
0
votes
1
answer
40
views
How can I tell if a control is actually Visible in UWP?
I'm trying to see if one of my controls is Visible (to put focus on it), but when I check the Visibility property, it is always Visible, even if an ancestor is hidden. How can I tell if a given ...
0
votes
0
answers
103
views
Linker errors when adding a native c++ static library to Windows runtime component (UWP)
Adding a native C++ library to Windows runtime component (C++ Winrt) project throws error (LINK : fatal error LNK1104: cannot open file 'comsuppw.lib').
I have followed https://learn.microsoft.com/en-...
0
votes
0
answers
93
views
How to obtain the real-time properties of a custom title bar in C++/WinRT WinUI3
What I get from m_mainWindow.MyBut().ActualOffset() or m_mainWindow.MyBut().TransformToVisual() is 0. The value of the coordinate attribute will only change when the window changes.
I tried the link ...
0
votes
1
answer
29
views
How do I get the typename of an arbitrary XAML FrameworkElement?
For an arbitrary WinUI/UWP FrameworkElements in C++/WinRT, how can I get its concrete type name (i.e. what type of control it is)?
In my code, I have a function that works with FrameworkElements (and ...
0
votes
0
answers
219
views
Get child element from a Window Handle in WinUI3
I am trying to find child elements from a parent Window Handle. I have a WinUI3 project which has button in stackpanel. The Sample code is given like this,
In MainWindow.xaml
<StackPanel ...
0
votes
0
answers
74
views
Using C++ MFC and WinRt error "this function must be called from a UI thread"
I have a MFC application which calls a coroutine named CheckForAppUpdates, from its OnInitDialog function. When the code executes, I get an error message:
this function must be called from a UI ...
-1
votes
1
answer
218
views
Modal ContentDialog WinUI
The idea is to replace MessageBox() in my code with a function that would show a ContentDialog with Yes/No, for example. Since this is an existing code from a big Win32 project to WinUI I can't ...
1
vote
1
answer
70
views
C++/CX using abstract + final keywords together
I'm working on a C++/CX project and just came across the following definition:
#pragma once
struct ColorHelper abstract final {
static COLORREF Lighten(COLORREF color, int amount);
static ...
0
votes
0
answers
66
views
Mocking Windows APP SDK classes using C++/winrt
I face a problem how to create SolidColorBrush inside test suites. When I do it using the constructor, I get winrt::hresult_wrong_thread, which seems reasonable because when I run the tests, there is ...
0
votes
1
answer
120
views
MSIX Packaging Tool "Cannot open include file"
I am at a loss here and could use some help. I am using the MSIX Packaging Project in visual studio to package my c++ UWP application, however when I try to publish it I get errors:
CL.exe /c /I"...
1
vote
0
answers
211
views
Why does my C++/WinRT program with an IAsyncOperation take 2 seconds longer if I remove system("");?
I have written a short C++ program that uses the WinRT Geolocation API to print the user's location to the console. Here's a minimal working excerpt:
#include <winrt/Windows.Devices.Geolocation.h&...
0
votes
0
answers
24
views
Cannot link InMemoryRandomAccessStream [duplicate]
I have a C++ class that utilizes winrt::Windows::Storage::Streams::InMemoryRandomAccessStream. This class will compile, but it will not link... I get the following error:
LNK2019 unresolved external ...
2
votes
1
answer
155
views
How to drag and drop external files in C++/WinRT WinUI3?
I saw the same problem, but the author did not provide a solution.
I am sure that all methods are the same as that problem, and all processes are using the Administrator.
But it doesn't work, dragging ...
0
votes
0
answers
121
views
Windows::Devices::Enumeration::DeviceInformation::CreateWatcher in C++ without WinRT namespace
I am making Windows app that connects to a BLE device. App is made in C++ (due to allot of legacy code). Overall the app is OK, the only problem I have is scanning for devices nearby.
Using ...