Reputation: 21
Microsoft Documentation provides the code to implement interoperation between XAML and a DirectX swap chain with C++ [1]:
Microsoft::WRL::ComPtr<ISwapChainPanelNative> m_swapChainNative;
// ...
IInspectable* panelInspectable = (IInspectable*) reinterpret_cast<IInspectable*>(swapChainPanel);
panelInspectable->QueryInterface(__uuidof(ISwapChainPanelNative), (void **)&m_swapChainNative);
However, I was not able to figure out how I should implement this with C++/WinRT.
When using this code, I get the following error message :
" [...] 'reinterpret_cast': cannot convert from 'winrt::Windows::UI::Xaml::Controls::SwapChainPanel' to 'IInspectable *' "
I'm using DirectX12, Visual Studio 2017.
Upvotes: 2
Views: 934
Reputation: 815
I'm not sure why that WRL documentation is using reinterpret_cast
. C++/WinRT makes this pretty simple:
winrt::com_ptr<ISwapChainswapChainNative> m_swapChainNative;
// ...
swapChainNative = swapChainPanel.as<ISwapChainPanelNative>();
Upvotes: 1