C++ unmanaged code inside winform

1

First: I am using C# and C++ on windows 7.

I have created a basic rendering engine in c++ with directx 10. It works good as a stand alone application. But, when I sending the Form.Handle of a WinForm I want to render inside to the engine it crashes during D3D10CreateDeviceAndSwapChain with the following error:

HRESULT: 0x887a0001 (2289696769)
Name: DXGI_ERROR_INVALID_CALL

I get the handle from the winform during loading of the form.

unsafe {
  void *ptr=m_view.Handle.ToPointer();
  uint v = (uint)ptr;
  lhandle = v.ToString();
};

Question also asked on gamedev.stackexchanged, was recommended asking it here as well.

c#
c++
winforms
directx
asked on Stack Overflow Aug 30, 2012 by Gosso

1 Answer

0

One has to create a CHILD to the parent window, not use the parent window handle directly.

answered on Stack Overflow Aug 31, 2012 by Gosso

User contributions licensed under CC BY-SA 3.0