Share via

unknown variable Direct2D 1.1 device-dependent resource initialization

thebluetropics 1,046 Reputation points
2022-09-07T04:56:07.723+00:00

This tutorial describes how to create a device context in Direct2D 1.1 application.

Please refer to the Selecting a target section.

I have several questions from this tutorial:

  1. Is DXGI_SWAP_CHAIN_DESC1 a temporary usage or I must store it in my main window class? (for further usage)
  2. Where did the m_hwnd in the CreateSwapChainForCoreWindow method come from?

The m_hwnd is the most frustating part from the tutorial. The tutorial did not mention anything about that. There are also many things that MSDN tutorials didn't mention, however I can know by just looking at the reference. The m_hwnd from nowhere, I looked at the reference fro CreateSwapChainForCoreWindow, it turns out that m_hwnd is a CoreWindow.

Where does the CoreWindow come from?

Edit: there is alternative, CreateSwapChainForHwnd, what is the difference between these two methods?

Windows development | Windows API - Win32
Developer technologies | C++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.

0 comments No comments

Answer accepted by question author

Castorix31 91,876 Reputation points
2022-09-07T05:45:29.313+00:00

DXGI_SWAP_CHAIN_DESC1 is just used once to create the SwapChain
CreateSwapChainForCoreWindow is for UWP
In desktop apps, you use CreateSwapChainForHwnd or CreateSwapChainForComposition
The window handle is from the main window, created with CreateWindowEx

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.