In CCube::InitDevice, I OR-ed in D3D11_CREATE_DEVICE_DEBUG so that I could tell the DirectX Control Panel to monitor the application. There are some object leaks. The CCube destructor needs to safe-release m_pConstantBuffer and m_pRenderTargetView. Also, when the window is resized, InitRenderTarget creates another render target view and reuses m_pRenderTargetView. The previous target view needs to be released. I added a safe-release of m_pRenderTargetView just before the CreateRenderTargetView function call.
In CCube::InitDevice, I OR-ed in D3D11_CREATE_DEVICE_DEBUG so that I could tell the DirectX Control Panel to monitor the application. There are some object leaks. The CCube destructor needs to safe-release m_pConstantBuffer and m_pRenderTargetView. Also, when the window is resized, InitRenderTarget creates another render target view and reuses m_pRenderTargetView. The previous target view needs to be released. I added a safe-release of m_pRenderTargetView just before the CreateRenderTargetView function call.