DX + Windows Forms..

Started by
1 comment, last by OrenGL 19 years, 6 months ago
I've reached the point that I need to start making tools for my current engine. I was reading about the new Windows Forms, and decided to use them over MFC. What I'm running into however, is that Windows Forms wants you to use Managed Directx, which doesn't at all fit in with my current rendering abstraction. Can anyone help me out in understanding how to pull up unmanaged directx in windows forms using c++? Any help would be appriciated. ~Main
==Colt "MainRoach" McAnlisGraphics Engineer - http://mainroach.blogspot.com
Advertisement
I *assume* you'd do it as usual, and use the Form.Handle property to get a HWND when initializing the device.

What Coder means is that you can pass a "Handle" property (just a member variable) which is a hWnd from the managed part to the unmanaged part to use when creating the Device. Just pass it as a *void and cast it back. Works fine for me. Doesn't have to be of the main window itself either, it can just be one of the panels in the form too.

About using WinForms with unmanaged code in general, you have a few options. You can write the managed part in a different project and access the unmanaged part via P/Invoke or you can write you unmanaged part a managed wrapper or you can wrap your unmanaged part as a COM object. I don't know which is best; I'm trying them out myself ;)
Don't shoot! I'm with the science team.....

This topic is closed to new replies.

Advertisement