721
questions
0
votes
0
answers
25
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
14
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
34
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
76
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 ...
0
votes
1
answer
58
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 ...
2
votes
0
answers
124
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
72
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
74
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
72
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
165
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
88
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
69
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
149
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
83
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
79
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
67
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
60
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
147
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
63
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
144
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
85
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/...
0
votes
0
answers
100
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
320
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
104
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
112
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
78
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
69
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
30
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
1
answer
88
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
82
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
27
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
164
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
68
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
194
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
61
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
59
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
111
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
194
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 ...
0
votes
1
answer
132
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
89
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 ...
0
votes
0
answers
377
views
How to use a custom MediaSource for a virtual camera? Also, how and where should I register the CLSID for my virtual camera?
I'm working on a C++ UWP application using the Microsoft Media Foundation library. My app aims to create a virtual camera that can use a video file as its video source.
Virtual camera creation:
winrt::...
1
vote
1
answer
208
views
{CustomResource} in Data Binding in C++ WinUI3
While working in data binding in C++ WinUI3 app (and I 've learned a bit thanks to SimonMourier's demo I am also looking at the {CustomResource} data binding method.
I create the WinUI Packaged ...
0
votes
1
answer
386
views
WinUI3 C++ Data Binding
In reference to my question about TreeView, I was suggested to use data binding to populate the items of the TreView.
I create a new Black App, Packaged, WinUI3 in Desktop C++ VS 2022 project.
This ...
1
vote
1
answer
260
views
How to read images from memory to ImageSource in C++/WinRT (WinUI3)?
[1]
I want to display an image for the Image control in XAML, but this image comes from a bytes array.
What should I do? The image format may be one of JPG, BMP, or PNG.
<Image x:Name="img&...
0
votes
0
answers
39
views
how to get a UWP xaml control from a dll to host it in xamlisland
I have a win32 app with a xaml island. I want to host some UserControl which is implemented in a different dll. How do I get the user control from the dll and host it in xaml island. Following is the ...
0
votes
1
answer
176
views
WinRT C++ UWP "Picker"
Architecturally, Im generally ignorant to the broader windows c++ ecosystem. Documentationaly, the docs skew c# so its hard for me to bridge the gap sometimes.
I want to use the winrt graphics capture....
0
votes
0
answers
90
views
Is there a method that concatenates two wil::unique_bstr string in WinRT?
There is a Windows Implementation Library (wil), documentation available in github text, that provides wrapper class for bstr that allows manipulation of BSTR.
I am porting my legacy code to WinRT ...
0
votes
1
answer
94
views
Built in Boolean to Visibility converter wont compile
I'm trying to bind Visibility to ToggleButton::IsChecked using automatic IReference to Visibility conversion
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" ...