1

I am working on a game engine right now. I am planning to use WPF as my level editor UI.

I am going to wrap the base engine functionality like video tutorial below.

https://www.youtube.com/watch?v=cqsj__ZVm-c

or using swig

http://www.swig.org/

I am wondering, how can I pass the window handler from WPF to the unmanaged c++? I am using DirectX11.

something like: class GraphicSystem { .... void Initialize( hwnd window); }

"Draw implementation"

void Initialize(hwnd window)
{
    // Create the Direct3D object.
    m_D3D = new D3DClass;

    // Initialize the Direct3D object.
    result = m_D3D->Initialize(screenWidth, screenHeight, VSYNC_ENABLED, hwnd,                   
                               FULL_SCREEN, SCREEN_DEPTH, SCREEN_NEAR);
}

So I can manage the viewport ("window") properties such as size from wpf.

  • WPF does not like window handles very much. You need to create a host for such a window, the MSDN library article [is here](https://msdn.microsoft.com/en-us/library/ms752055%28v=vs.110%29.aspx). – Hans Passant Apr 23 '15 at 10:51

1 Answers1

0

Check this link for getting the HWND of your WPF app: How to get the hWnd of Window instance?

I guess you can use Interop to pass the value to the C++ code.

Community
  • 1
  • 1