235 questions
0
votes
0
answers
61
views
WinRT pairing fails with error 19 the first time an attempt is made by a script
I'm using bleak and winRT to write a python application.
In this application the device should be paired and connected to a Windows Pc automatically after providing mac address and PIN.
The connection ...
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 ...
2
votes
1
answer
209
views
IAsyncOperation "Completed" handler race conditions?
The IAsyncOperation<TResult> interface exposes a Completed property, which users can attach methods to that are invoked when the operation completes.
MS has example code online that illustrates ...
1
vote
0
answers
250
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
365
views
How to use get_strong/get_weak with co_await
I was reading the following documentation -
https://learn.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/weak-references#safely-accessing-the-this-pointer-in-a-class-member-coroutine
I understand ...
0
votes
0
answers
120
views
How to update progress in UI using IAsyncOperationWithProgress from within a callback
I have following code structure:
winrt::Windows::Foundation::IAsyncOperationWithProgress<Transfer::TransferStatus, Transfer::TransferProgress> Windows::
TransferClient::TransferAsync(winrt::...
0
votes
1
answer
286
views
how to wait for FileOpenPicker in UWP/WinRT to display and get the selected file from user? (C++ code)
I am new in UWP/WinRT!
I have this code:
void MainPage::processButton_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e)
{
...
0
votes
1
answer
189
views
How do I replace resume_background() when migrating a C++/WinRT Xaml App to the Rust Crate for Windows?
Is CoreDispatcher.RunIdleAsync the correct method call to replace the apartment_context, resume_background combination in the main_async function below?
If this was correct, would it then follow that ...
2
votes
1
answer
2k
views
Event handling with WinRT for python
The Task
I'm trying to make a tool that auto recognizes playback from a non Spotify source and pauses Spotify for the duration of the other audio. I've been using Microsoft's WinRT projection for ...
0
votes
0
answers
77
views
UWP: Lifecycle event when the content on elements becomes available when content is set using async
I have UWP page and it is using data binding to set content on xaml elements (texts, buttons, image). I am setting the content using async calls (getting content from internet). In the page's c'tor, I ...
0
votes
1
answer
123
views
Why I am getting C3646 on an IAsyncAction declaration?
Probably a dumb question (WinRT noob), but, here is goes...
The code from "App.xaml.h" is:
namespace winrt::Precog::implementation
{
struct App : AppT<App>
{
App();
...
2
votes
0
answers
579
views
WinRT/C++ std::thread vs winrt::resume_background()
After studying std::thread, I know that a function can be run on a different thread than the main thread, which is similar to the concept of winrt::resume_background() which will continue executing ...
1
vote
1
answer
791
views
WinRT/C++ What is apartment_context actually?
What I know is that apartment_context is used to capture UI Thread and return to the UI Thread when it is in the background ThreadPool.
So, what is apartment_context actually in WinRT/C++? And how to ...
0
votes
0
answers
428
views
WinRT/C++ co_await resume_foreground(Dispatcher()) cause try_as runtime error
What causes the try_as() runtime error to occur when calling co_await resume_foreground(Dispatcher()) in the LoadOverallStatisticsAsync() function.
Note: using resume_foreground(Dispatcher()) is only ...
0
votes
0
answers
375
views
C++Winrt How to throw an exception from an async method
I have following code
IAsyncOperation<bool> trythiswork()
{
bool contentFound{ false };
try
{
auto result = co_await someAsyncFunc();
if (...
0
votes
1
answer
775
views
How can you `co_await` in a C++/WinRT lambda?
Can you co_await in a C++/WinRT TimerElapsedHandler (or any other lambda in C++/WinRT)?
When I try to compile code like this:
auto pointerExitedTimerHandler = winrt::TimerElapsedHandler([](const winrt:...
4
votes
1
answer
296
views
In a in WinRT app, how do I connect using TLS1.2?
I've got a Windows Store app that's a WinRT Phone/Desktop app (i.e. not a UWP app), targeting Windows 8.1 and up.
It's been on the store for several years now, but recently it stopped being able to ...
1
vote
1
answer
970
views
UWP C# : Progress of IAsyncOperationWithProgress
How do I capture the progress of an IAsyncOperationWithProgress and send it to a ProgressBar?
var packageManager = new PackageManager();
var packageUri = new Uri("https://example.com/");
var ...
0
votes
1
answer
2k
views
UWP C++/WinRT: Asynchronous Sleep
How can I wait a specific amount of time without blocking the UI thread? I'm looking for await Task.Delay() equivalent in C++/WinRT.
IAsyncAction MainPage::ClickHandler(IInspectable const&, ...
1
vote
0
answers
2k
views
Bluetooth LE - Characteristic Values only read once
I am developing a Windows app, that reads values from a characteristic. Its a very simple task, and i managed to write working code. Everything does what it should - but only on my development PC.
I ...
0
votes
0
answers
304
views
Check if a device is in use [UWP]
I'm using UWP API from C++ via WinRT and want to check if a camera is in use (before trying to access or open it):
using namespace winrt;
using namespace Windows::Devices::Enumeration;
auto cameras =...
1
vote
1
answer
519
views
How to fix 'the arguments to the parameterized interface are not valid' error of IDL file in WinRT?
I'm getting "the arguments to the parameterized interface are not valid" error when trying to write IDL file for my Windows Runtime Component class.
The RunAsync() function returns winrt::Windows::...
2
votes
1
answer
100
views
Are asynchronous Windows Runtime calls guaranteed to expire?
The Windows Runtime heavily uses asynchronous patterns, offloading long(-er) running tasks to the thread pool. I've read through all articles in Threading and async programming, but couldn't find an ...
0
votes
1
answer
473
views
Convert win32 hbitmap to winrt softwarebitmap
I am implementing OCR functionality and need to use softwarebitmap to call the function, in case I have the file path there is no issue with creating a softwarebitmap object, but in some cases there ...
1
vote
1
answer
323
views
winrt/c++: await result from dispatched task
I want to dispatch a job to the UI thread, then wait for the result and use it from another thread. Like this, but co_await does not work inside the lambda:
dispatcher.RunAsync(CoreDispatcherPriority:...
0
votes
2
answers
480
views
Geolocator PositionChanged event not firing for getting current location
I am trying to get current location for WinRT application.
But PositionChanged event never gets fired.
Any help is highly appreciated !
In Package.appxmanifest, I have enabled Location.
My code is ...
0
votes
2
answers
943
views
AsyncStatus, wait for Status completed or canceled
I have a function to send an e-mail:
public async Task<bool> ComposeEmail(string email, string subject)
{
var emailMessage = new Windows.ApplicationModel.Email.EmailMessage();
emailMessage....
1
vote
2
answers
916
views
Delphi - Making asynchronous calls to WinRT API using TTask.Future
Related to this question, I am trying to implement a procedure that uses the WinRT API to set the desktop wallpaper. To mimic the await functionality in C#, I am using TTask.Future (link) as outlined ...
0
votes
0
answers
2k
views
How to wait for IAsyncOperation to finish using C++ WRL?
I am writing code to consume WinRT API on Windows 10 using C++ WRL (i.e. without using either C++/CX or C++/CLI). I am using GetAppListEntriesAsync() from Package class to get names of UWP ...
0
votes
1
answer
578
views
Cancel IInputStream.ReadAsync if connection to host is lost
I'm writing a UWP (WinRT) solution that downloads a file from a server and saves to disc while indicating progress. For this purposes I extended the IAsyncOperationWithProgress method.
My problem is ...
1
vote
1
answer
1k
views
In UWP StreamSocket, can I read data with timeout and leave the connection open if timeout elapses
As I couldn't find any way to peek for data (read data without consuming the buffer) as asked at How to peek StreamSocket for data in UWP apps I'm now trying to make my own "peek" but still no luck.
...
0
votes
1
answer
72
views
ApplicationData.ClearAsync() doesn't work in Windows 8.1 Universal App
I'm trying to clear the application data when user logout of the application & I found ApplicationData.ClearAsync() which fits my requirement which is similar to IsolatedStorageSettings....
0
votes
1
answer
32
views
Windows 8.1 store apps OnCommandsRequested doesn't add ApplicationCommands when async used
On the App.xaml.cs I have the following code
private async void OnCommandsRequested(SettingsPane settingsPane, SettingsPaneCommandsRequestedEventArgs e)
{
var loader = ResourceLoader....
1
vote
0
answers
735
views
How to properly wait for asynchronous WinRT callback functions to stop?
I asked a similar question before but the answer there did not satisfy my requirement. Let me explain.
I call the following code from a DLL to perform a WinRT operation on Windows 10 from a Windows ...
0
votes
1
answer
651
views
Windows PPL(C++): Is this the correct way to test if a task is done?
Is this the correct way to test if a task is done?
const concurrency::task<void> voidTask;
if (voidTask != m_getInfoAsync)
{
if (!m_getInfoAsync.is_done())
{
return 0;
}
}
...
0
votes
1
answer
203
views
Still getting the exception "application called an interface that was marshalled for a different thread" after using Dispatcher
public ObservableCollection<College> Colleges { get; set; }
My collection holding College data.
public static Task<College> getCollege(string uniqueid)
{
return Task.Run(()...
2
votes
2
answers
310
views
Does every WinRT/Windows Core thread have a Dispatcher?
We're providing a library that needs to run code on its own custom threads. Once done, I want these threads to call callbacks (event handlers) through a Dispatcher (System.Windows.Threading.Dispatcher)...
1
vote
1
answer
223
views
Task not cancelled after a specified timeout
I'm using a StreamSocketListener to await a connection on a port. I don't want it to listen forever, it must cancel after a specific number of seconds, for which I'm using the following code.
...
1
vote
1
answer
82
views
How to show progress bar at application level in Win RT application?
I had two xaml pages like FirstPage.Xaml and SecondPage.Xaml .
On FirstPage.xaml I am generating pdf of all image recods by rendering image control available on my SecondPage.Xaml.
What I am doing is ...
3
votes
1
answer
841
views
How can I efficiently update the UI from an async method?
I'm using a ProgressBar with binding to show the progress when receiving a file from a remote device.
<ProgressBar Width="500" Height="50" Value="{Binding ProgressFileReceive}"/>
...
2
votes
0
answers
457
views
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM in Windows store application
I am using VS 2013 for developing my Windows Store app using C#.
Here I am invoking a service call to upload image as byte array. See below the codes:
public async void SanUploadImage(...
1
vote
2
answers
55
views
Winrt Wpf databinding
I am having no luck finding the issue of data binding not working. I have two user controls. The user control that uses the obervablecollection works fine. The user control bound to an object doesnt....
0
votes
1
answer
281
views
How to generate custom Thumbnail image of an image in WinRT? Looking for an algorithm similar to StorageFile.GetThumbnailAsync
I ran into an issue when i tried to access the thumbnail image of a file which is in local storage of the app(due to access issues). And the workaround suggesting :
1.copying the file to public ...
0
votes
1
answer
193
views
Launch a Win Forms app from a metro app(using java script and html)
I want to launch a Win Form app from a metro style application.I tried Launcher.LaunchFileAsync(IStorageFile) | launchFileAsync(IStorageFile) API
but the documentation says as metro application runs ...
1
vote
1
answer
70
views
Non Blocking UI with Gmail Api in Winrt
I am developing an gmail client in uwp and want to use gmail api but the want the get messages asynchronous wihout blocking the ui the following method blocks the ui.
public async Task<...
0
votes
1
answer
806
views
C# Windows Store WebView InvokeScriptAsync select drop down
I am trying to use a WebView control to programmatically select
<select id="ChooseOption">
<option value="Value1">Option1</option>
<option value="Value2" selected>...
1
vote
0
answers
274
views
HRESULT E_FAIL exception from a WinRT assembly loaded within a WPF application
Basically I want to access the open, modify and store a Printing3D3MFPackage object. It is only available for UWPs. I added this two references to my WPF project:
C:\Program Files (x86)\Windows Kits\...
4
votes
2
answers
1k
views
Canceling navigation in Page.OnNavigatingFrom with MessageBox
I have a two-page WinRT application, where the first navigates to the second. I want to ask the user in OnNavigatingFrom if he really wants to navigate to the second, via a message box. The navigation ...
0
votes
2
answers
116
views
ObservableCollection and UnhandledException with unspecified error in Windows Phone 8.1
I have the following code where if i remove the ´Task.Delay´ it throws an UnhandledException with message "Unspecified error".
This exception is not thrown from the actual code and will not be ...