c++-winrt

Can't activate projected type defined in IDL

浪子不回头ぞ 提交于 2019-12-12 00:52:04
问题 I was trying to define a Windows Runtime type in IDL, and consume its projected type. Going from a default-generated Blank App UWP project (called "Blank App" ), I added "MyControl.idl" : namespace BlankApp { [default_interface] runtimeclass MyControl : Windows.UI.Xaml.Controls.Control { MyControl(); } } Compiled the solution, then copied MyControl.h and MyControl.cpp from Generated Files/sources to the project root directory. I included the header for the projected type and added the

ERROR_ACCESS_DENIED while using BluetoothLEAdvertisementWatcher in C++/WinRT

旧街凉风 提交于 2019-12-11 17:14:28
问题 I'm trying to use BluetoothLEAdvertisementWatcher to detect BLE advertising packets. However upon calling Start() the watcher object always aborts with 'Access is denied' error. Code is pretty simple and is as below: auto filter = BluetoothLEAdvertisementFilter(); auto advert = BluetoothLEAdvertisement(); advert.LocalName(L"Greeny"); filter.Advertisement(advert); m_watcher.AdvertisementFilter(filter); // setup event handlers m_watcher.Received({ this, &MainPage::OnAdvertisementRecieved }); m

Decompress ZIP archive in a native Windows Runtime component/application

佐手、 提交于 2019-12-11 16:54:39
问题 This seems to be a simple task, yet my research left me with nothing: How do you extract items from a ZIP archive in a native Windows Runtime component (or application)? Now if I were to target .NET, there's a ZipArchive and ZipFile class, that make the solution as simple as it should be. But what, if I cannot or do not want to take a dependency on the CLR? The only compression support I was able to find in the Windows Runtime is the Windows.Storage.Compression Namespace, and there's really

Scope of Collections in Winrt And PhotoEditor example

牧云@^-^@ 提交于 2019-12-11 09:02:53
问题 Winrt::Windows::Foundation::Collection only has interfaces no concrete collection type. I have been told to use Platorm::Collections, but not sure how you get to that from Winrt::Windows::?????. I thought its only for C++/Cx 3.I have copied and used the Observable_Vector in PhotoEditor sample but am getting error on build saying my type in vector does not implement GetTrustLevel(). If i cannot use Platform::Collections in WInrt, that means currently there is only one example of how to use

Is Win2D yet available in C++/WinRt?

大憨熊 提交于 2019-12-08 00:41:06
问题 I need to use win2D in my cppwinrt project. Using the Win2D sample file as a model I’ve tried to mimic its setup, putting in the package file for win2d from that project, duplicating the custom build step, but I can’t get it to compile. I remember some talk about Win2D being added soon to the standard cppwinrt headers so that it could be accessed like others of these wonderful cppwinrt interfaces. Is this something that might happen soon? Or does anyone have some really specific instructions

Is Win2D yet available in C++/WinRt?

五迷三道 提交于 2019-12-06 12:23:52
I need to use win2D in my cppwinrt project. Using the Win2D sample file as a model I’ve tried to mimic its setup, putting in the package file for win2d from that project, duplicating the custom build step, but I can’t get it to compile. I remember some talk about Win2D being added soon to the standard cppwinrt headers so that it could be accessed like others of these wonderful cppwinrt interfaces. Is this something that might happen soon? Or does anyone have some really specific instructions for using Win2D in the current Visual Studio 2017 environment? I’m in the Insider preview program but

Getting “a function that returns 'auto' cannot be used before it is defined” while using CoreDispatcher::RunAsync in C++/WinRT project

别等时光非礼了梦想. 提交于 2019-12-02 07:31:06
In my C++/WinRT project, I am trying to run some code on UI thread but getting an error that says: "winrt::impl::consume_Windows_UI_Core_ICoreDispatcher<winrt::Windows::UI::Core::ICoreDispatcher>::RunAsync': a function that returns 'auto' cannot be used before it is defined" I am invoking the method like this: Dispatcher().RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, [=]() { // Code to be executed. }); The implementation is coming from auto generated winrt file which returns auto as a return type. template <typename D> struct consume_Windows_UI_Core_ICoreDispatcher { [[nodiscard

Can C++/CX and C++/WinRT be used in the same project?

浪尽此生 提交于 2019-11-30 12:30:54
Earlier this week, Kenny Kerr presented C++/WinRT at CppCon 2016 1 . It is a Standard C++ projection for the Windows Runtime, based on Modern . As far as I understand, the C++/CX compiler/preprocessor/code generator doesn't touch Standard C++ code, and with C++/WinRT being a Standard C++ library it is my naïve interpretation, that both C++/CX and C++/WinRT can be used in the same project. Questions: First things first: Is my naïve interpretation correct? If so, can C++/CX and C++/WinRT be used in the same compilation unit? At what granularity can C++/CX and C++/WinRT be mixed, in case they

C++/WinRT, part of Windows SDK 17134 is not compatible with Visual Studio 15.8 Preview 3

允我心安 提交于 2019-11-30 08:28:47
问题 Trying to compile the following code: #include <winrt/base.h> int main() {} With the following compiler options: /permissive- /std:c++latest With recently released Visual Studio 15.8 Preview 3.0 results in the following compilation errors: 1>------ Build started: Project: test1, Configuration: Debug x64 ------ 1>Source.cpp 1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\cppwinrt\winrt\base.h(2185): error C3861: 'from_abi': identifier not found 1>c:\program files (x86)\windows

Is there a way of getting ConnectionStatus from IVpnProfile in a UWP application?

烈酒焚心 提交于 2019-11-29 09:36:36
I have the following WinRT code which works fine to discover active VPN Profiles: VpnManagementAgent vpn; auto profiles = vpn.GetProfilesAsync().get(); wprintf(L"Found %d profiles\n", profiles.Size()); for (auto vp : profiles) { wprintf(L"Found profile %s\n", vp.ProfileName().c_str()); } I would like to check the ConnectionStatus but this is not available on the IVpnProfile interface. I have tried adding the following to no avail as ConnectionStatus is available in the concrete VpnPlugInProfile and VpnNativeProfile classes: VpnPlugInProfile pp = vp.as<VpnPlugInProfile>(); if (pp != nullptr)