wrl

Using winrt::com_ptr<ID3D11Device1> with D3D11CreateDevice()?

对着背影说爱祢 提交于 2020-12-07 05:17:46
问题 I've been studying the code from the DirectXTK example project and trying to implement it in a new project. It seems like Microsoft recommends using WinRT in new projects, though, so I decided I would try to switch instances of WRL::ComPtr to winrt::com_ptr . I'm stuck, though, trying to move between ID3D11Device1 in the project's Game class and ID3DDevice in D3D11CreateDevice() . Here's the example code, slightly abstracted for simplicity's sake: ComPtr<ID3D11Device1> global_device; void

Using winrt::com_ptr<ID3D11Device1> with D3D11CreateDevice()?

荒凉一梦 提交于 2020-12-07 05:15:48
问题 I've been studying the code from the DirectXTK example project and trying to implement it in a new project. It seems like Microsoft recommends using WinRT in new projects, though, so I decided I would try to switch instances of WRL::ComPtr to winrt::com_ptr . I'm stuck, though, trying to move between ID3D11Device1 in the project's Game class and ID3DDevice in D3D11CreateDevice() . Here's the example code, slightly abstracted for simplicity's sake: ComPtr<ID3D11Device1> global_device; void

Using winrt::com_ptr<ID3D11Device1> with D3D11CreateDevice()?

只谈情不闲聊 提交于 2020-12-07 05:14:59
问题 I've been studying the code from the DirectXTK example project and trying to implement it in a new project. It seems like Microsoft recommends using WinRT in new projects, though, so I decided I would try to switch instances of WRL::ComPtr to winrt::com_ptr . I'm stuck, though, trying to move between ID3D11Device1 in the project's Game class and ID3DDevice in D3D11CreateDevice() . Here's the example code, slightly abstracted for simplicity's sake: ComPtr<ID3D11Device1> global_device; void

How to properly wait for asynchronous WinRT callback functions to stop?

一曲冷凌霜 提交于 2020-01-25 21:52:08
问题 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 Store app. The code uses WRL: #include <Windows.Services.Store.h> #include <wrl.h> auto onAppLicCompletedCallback = Callback<Implements<RuntimeClassFlags<ClassicCom>, IAsyncOperationCompletedHandler<StoreAppLicense*>, FtmBase>>( [](IAsyncOperation<StoreAppLicense*>* operation, AsyncStatus status) {

Can't use create_async() with WRL WinRT component

依然范特西╮ 提交于 2019-12-30 12:15:28
问题 I want to write a WinRT component with async support using WRL, but I found create_async() is undefined even I included the ppltask.h and using namespace concurrency How to create a background task with WRL pattern? My function is like: HRESULT GetStreamAsync([out, retval] IAsyncOperation<IRRandomAccessStream*>** operation); I also try to use IThreadPoolStatics->RunAsync() , but seems it only can be used in case of IAsyncAction and without return value. Does anyone can help? 回答1: concurrency:

OfflineLicensesChanged event is never raised when trial license expires for a Windows 10 Store app

家住魔仙堡 提交于 2019-12-24 08:47:19
问题 I'm trying the following code for my Win32 app converted to UWP for the Windows 10 Store. The app is posted in the store under a trial license for 7 days. The goal of the code below is to receive a notification when the app's trial period expires: #include <Windows.Services.Store.h> #include <wrl.h> #include <wrl/event.h> //'hMainWnd' = HWND handle to the app's main window //ComPtr<IStoreContextStatics> storeContextStatics; //... ComPtr<IStoreContext> storeContext; hr = storeContextStatics-

How to return a build-in winrt component using WRL?

北慕城南 提交于 2019-12-10 11:29:30
问题 When I create a winrt component using WRL, the problem is that I can only use ABI::Windows::xxx namespace, and I cannot use Windows::UI::Xaml::Media::Imaging namespace in WRL. Then, how to create a build-in winrt component as a return value? // idl import "inspectable.idl"; import "Windows.Foundation.idl"; import "Windows.UI.Xaml.Media.Imaging.idl"; namespace Decoder { interface IPhotoDecoder; runtimeclass PhotoDecoder; interface IPhotoDecoder : IInspectable { HRESULT Decode([in] int width,

How to cancel asynchronous callback function in C++/WRL?

旧时模样 提交于 2019-12-08 06:08:59
问题 I'm writing Windows 10 Store / WinRT code using C++/WRL which I'm new to. And I'm curious to know how do I cancel long-pending asynchronous operation? The best way to illustrate it is with this example: #include <Windows.Services.Store.h> #include <wrl.h> auto onAppLicCompletedCallback = Callback<Implements<RuntimeClassFlags<ClassicCom>, IAsyncOperationCompletedHandler<StoreAppLicense*>, FtmBase>>( [](IAsyncOperation<StoreAppLicense*>* operation, AsyncStatus status) { //Asynchronous operation

How to cancel asynchronous callback function in C++/WRL?

坚强是说给别人听的谎言 提交于 2019-12-08 05:22:28
I'm writing Windows 10 Store / WinRT code using C++/WRL which I'm new to. And I'm curious to know how do I cancel long-pending asynchronous operation? The best way to illustrate it is with this example: #include <Windows.Services.Store.h> #include <wrl.h> auto onAppLicCompletedCallback = Callback<Implements<RuntimeClassFlags<ClassicCom>, IAsyncOperationCompletedHandler<StoreAppLicense*>, FtmBase>>( [](IAsyncOperation<StoreAppLicense*>* operation, AsyncStatus status) { //Asynchronous operation is done return S_OK; }); //'opAppLic' is defined as: // ComPtr<IAsyncOperation<StoreAppLicense*>>

How to return a build-in winrt component using WRL?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 11:03:12
When I create a winrt component using WRL, the problem is that I can only use ABI::Windows::xxx namespace, and I cannot use Windows::UI::Xaml::Media::Imaging namespace in WRL. Then, how to create a build-in winrt component as a return value? // idl import "inspectable.idl"; import "Windows.Foundation.idl"; import "Windows.UI.Xaml.Media.Imaging.idl"; namespace Decoder { interface IPhotoDecoder; runtimeclass PhotoDecoder; interface IPhotoDecoder : IInspectable { HRESULT Decode([in] int width, [in] int height, [out, retval] Windows.UI.Xaml.Media.Imaging.BitmapImage **ppBitmapImage); } [version