title: How to CreateSwapChainForHwnd
body: <p>In the following code, where device is an instance of <code>ComPtr&lt;ID3D12Device&gt;</code> that was successfully initialized with <code>D3D12CreateDevice</code>, I am getting an failing <code>HRESULT</code>.  I get the value 0x887a0001.  I would appreciate any ideas as to what I am doing wrong.</p>
  
  <pre><code>DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {};
  swapChainDesc.Width = 0;
  swapChainDesc.Height = 0;
  swapChainDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
  swapChainDesc.Stereo = FALSE;
  swapChainDesc.SampleDesc.Count = 1;
  swapChainDesc.SampleDesc.Quality = 0;
  swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
  swapChainDesc.BufferCount = 2;
  swapChainDesc.Scaling = DXGI_SCALING_NONE;
  swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
  swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_STRAIGHT;
  swapChainDesc.Flags = 0;
  
  ComPtr&lt;IDXGISwapChain1&gt; swapChain;
  ThrowIfFailed(factory-&gt;CreateSwapChainForHwnd(device.Get(), wnd.handle(),
                                                &amp;swapChainDesc, nullptr,
                                                nullptr, &amp;swapChain));
  </code></pre>