Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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();
};
share|improve this question
1  
For better support, also try stackoverflow, this is a good candidate question for that site. –  teodron Aug 30 '12 at 16:03
    
Can you show your actual D3D10CreateDeviceAndSwapChain/CreateDevice call? –  CiscoIPPhone Aug 30 '12 at 16:43
    
This is the code that I call in Render::Init(...) : pastebin.com/rPw3HNSa –  Gosso Aug 30 '12 at 16:50
1  
So it's an entirely different process - that could be causing the issue. Perhaps it would work if the C++ app was a dll called from the C# app? I'll see if I can find any more info about this. –  CiscoIPPhone Aug 30 '12 at 19:19
1  
Make your c++ engine a dll or make a CLR wrapper for it, then it will work. –  Barış Uşaklı Aug 30 '12 at 19:33
show 4 more comments

1 Answer 1

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.