Simon Mourier's Avatar
Simon Mourier's blog (1807 answers on StackOverflow) about Microsoft technologies C#, C/C++, .NET, WinRT, WinUI3, AOT, P/Invoke, COM, Interop, DirectX, Direct2D, Windows, ...
  • 🔎︎ Search
  • Categories
  • Archives
  • About Me
  • c/c++
  • direct2D
  • graphics
  • wrl

direct2d quickstart with ID2D1Device3

Sep 18, 2021 See the question and my original answer on StackOverflow

You must first get an ID2D1Device2 and then QueryInterface on this. With WRL helpers, this would be a code similar to this:

Microsoft::WRL::ComPtr<ID2D1Device2> dev2;
Hres = factory->CreateDevice(dxgiDevice.Get(), &dev2);

Microsoft::WRL::ComPtr<ID2D1Device3> dev3;
Hres = dev2.As(&dev3); // does QueryInterface
  • SmoBlog © 2010-2026 Simon Mourier. All rights reserved.
  • Privacy & Terms