简体   繁体   中英

WPF System.Windows.Navigation.NavigationWindow in MFC application

I need to use a WPF Lib with a System.Windows.Navigation.NavigationWindow in a MFC Win32 app but I have a black screen instead of my WPF Windows. I have no error message in the debug output.

All the other WPF control I tried work fine in MFC (button, grid, D3D with C++).

Anyone have an idea how to debug that or how to investigate that?

Thanks

EDIT: The problem happen with System.Windows::Window too. And it work fineif I use my WPF in a WPF App.

I can't find a working solution but here's my workaround at the moment.

I created a separate a WPF app with my WPF Lib.

And in my MFC app I do:

HWND wpfProcessMainWnd = CreateProcessWPF();

SetParent(wpfProcessMainWnd, hWnd);

DWORD style = GetWindowLong(wpfProcessMainWnd, GWL_STYLE);
style |= WS_CHILD;
style &= ~(WS_BORDER | WS_OVERLAPPEDWINDOW);

SetWindowLong(wpfProcessMainWnd, GWL_STYLE, style);

SetWindowPos(wpfProcessMainWnd, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER);

From:
https://stackoverflow.com/a/16641537/2849700

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM