1

I have a monster of a win32 application with GUI based on a mixture of MFC, WTL, user32 and a few other technologies. I need to add another top-level window and I would like to give WPF a chance.

Could you help me identify the steps necessary to host a WPF window in win32 app? Details are welcome.

2 Answers 2

1

I'm sorry for giving trite answer, but I can't explain it better than it is explained at MSDN: Hosting WPF Content in a Microsoft Win32 Window, Walkthrough: Hosting a WPF Clock in Win32. You may also be interested in WPF Documentation samples at MSDN Code Gallery, or alternatively look at their mind-mapped version.

Sign up to request clarification or add additional context in comments.

Comments

0

Keep in mind if its a top-level window you're after (and not a window embedded within another window) you can simply create a new Window-derived WPF window from managed C++.

I.E., either 1) create a C++/CLI library that references your WPF library and call that from your unmanaged code or 2) add the /clr library setting (not recommended, due to performance implications) and add a reference to your WPF library. Then simply call:

#include <vcclr.h>

gcroot<MyWindow^> newWin = gcnew MyWindow();
newWin->Show();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.