我需要在 MFC Win32 应用程序中使用带有 System.Windows.Navigation.NavigationWindow 的 WPF 库,但我的 WPF Windows 不是黑屏。我在调试输出中没有错误消息。
我尝试过的所有其他 WPF 控件在 MFC 中都可以正常工作(按钮、网格、D3D 和 C++)。
有人知道如何调试或调查吗?
谢谢
编辑:问题也发生在 System.Windows::Window 上。如果我在 WPF 应用程序中使用我的 WPF,它工作正常。
最佳答案
我找不到可行的解决方案,但这是我目前的解决方法。
我用我的 WPF 库创建了一个单独的 WPF 应用。
在我的 MFC 应用程序中我这样做:
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);
关于c# - MFC 应用程序中的 WPF System.Windows.Navigation.NavigationWindow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27506813/