title: D3D11CreateDevice() returns garbage value and fails
body: <p>I just started studying direct 3d with the book <em>3D Game Programming with DirectX11</em>.</p>
  
  <p>I followed the first tutorial and got a MessageBox saying "D3D11CreateDevice Failed".</p>
  
  <p>I checked the return value of this function and got the garbage value of <code>-2005270483</code>.
  The hexadecimal value of <code>0x887a002d</code>, which people say it's <code>DXGI_ERROR_SDK_COMPONENT_MISSING</code> error.</p>
  
  <p>However, I couldn't find any information about it. Also, it was none of the possible value of <code>D3D11CreateDevice()</code> that MSDN notifies.</p>
  
  <p>Following is the code of the book creating the D3D device:</p>
  
  <pre><code>bool D3DApp::InitDirect3D()
  {
      // Create the device and device context.
  
      UINT createDeviceFlags = 0;
  #if defined(DEBUG) || defined(_DEBUG)  
      createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
  #endif
  
      D3D_FEATURE_LEVEL featureLevel;
      HRESULT hr = D3D11CreateDevice(
          0,                 // default adapter
          md3dDriverType,
          0,                 // no software device
          createDeviceFlags, // createDeviceFlags, 
          0, 0,              // default feature level array
          D3D11_SDK_VERSION,
          &amp;md3dDevice,
          &amp;featureLevel,
          &amp;md3dImmediateContext);
  
      if( FAILED(hr) )
      {
          // I added this part to check out the return value
          TCHAR str[100];
          int code = -1;
  
          switch(hr) {
          case D3D11_ERROR_FILE_NOT_FOUND: code=0;
              break;
          case D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS: code=1;
              break;
          case D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS: code=2;
              break;
          case D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD: code=3;
              break;
          case DXGI_ERROR_INVALID_CALL: code=4;
              break;
          case DXGI_ERROR_WAS_STILL_DRAWING: code=5;
              break;
          case E_FAIL: code=6;
              break;
          case E_INVALIDARG: code=7;
              break;
          case E_OUTOFMEMORY: code=8;
              break;
          case E_NOTIMPL: code=9;
              break;
          case S_FALSE: code=10;
              break;
          case S_OK: code=11;
              break;
          } // switch
          _stprintf(str, L"D3D11CreateDevice Failed. Code:%ld %d", hr, code);
  
          MessageBox(0, str, 0, 0);
          return false;
      } // if
  ...
  </code></pre>
  
  <p>I'm currently working on Windows 8.1 with DirectX version 11.
  My graphics card is NVIDIA GeForce GTX 650.
  Compiler I use is VS2010 Express.</p>
  
  <p>Does anyone knows what's the problem and solution?</p>