Performance issue when hosting a WPF form in a native C++ application Performance issue when hosting a WPF form in a native C++ application wpf wpf

Performance issue when hosting a WPF form in a native C++ application


The docs for WindowInteropHelper indicate that you should set the HELPER'S handle to your c++ handle

WindowInteropHelper wih = new WindowInteropHelper(myDialog);wih.Owner = ownerHwnd;myDialog.ShowDialog();

But you seem to be doing the opposite.


Nowhere in your post do you mention HwndSource or HwndHost which are the supported means of interoping between native code (either hosting WPF in Win32 or visa versa). WindowsInteropHelper is not intended to support full blown interop scenarios, it's only use is to basically get the Handle of a WPF Window.

These are a great series of articles and I recommend looking through them, because what you want to do is not going to be trivial unless it's a very limited scope.


you could try creating and using native images of your .NET-assembly via NGEN, this will significantly speed things up although i dont know how big the difference will be in your case ... at least it should reduce loading times