DXGI ERROR: IDXGIFactory::CreateSwapChain: No target window specified

I get "DXGI ERROR: IDXGIFactory::CreateSwapChain: No target window specified in DXGI_SWAP_CHAIN_DESC, and no window associated with owning factory. [ MISCELLANEOUS ERROR #6: ]"

From what i can see the only HWND in DXGI_SWAP_CHAIN_DESC, it is the OutpuWindow, and this is set.

HWND* DX_11_Capture::win = new HWND();
desk.OutputWindow = *DX_11_Capture::win;

Then when i call create:
HRESULT result = D3D11CreateDeviceAndSwapChain(0, D3D_DRIVER_TYPE_HARDWARE, 0,
D3D11_CREATE_DEVICE_SINGLETHREADED | D3D11_CREATE_DEVICE_BGRA_SUPPORT,
lvl, 4, D3D11_SDK_VERSION, &c.desk, &c.swap_chain, &c.device, &c.selected, &c.context);

In return i get "DXGI_ERROR_INVALID_CALL".
Registered users can post here. Sign in or register to post.