如何从Win32中托管的WPF窗口接收Win32消息?
我已在Win32应用程序中加载WPF窗口:如何从Win32中托管的WPF窗口接收Win32消息?,wpf,winapi,clr,Wpf,Winapi,Clr,我已在Win32应用程序中加载WPF窗口: case WM_INITDIALOG: { System::Windows::Interop::HwndSourceParameters p; p.WindowStyle = WS_VISIBLE | WS_CHILD; p.PositionX = 100; p.PositionY = 100; p.Width = 600; p.Height = 6
case WM_INITDIALOG:
{
System::Windows::Interop::HwndSourceParameters p;
p.WindowStyle = WS_VISIBLE | WS_CHILD;
p.PositionX = 100;
p.PositionY = 100;
p.Width = 600;
p.Height = 600;
p.ParentWindow = System::IntPtr(hDlg);
Globals::source = gcnew System::Windows::Interop::HwndSource(p);
Globals::source->RootVisual = gcnew MyControl();
return TRUE;
}
现在,我想通过在应用程序中接收win32消息来处理WPF窗口事件。
我怎样才能做到这一点?对于您的特定问题,我没有答案,但解决方法是将Win32程序移动到.DLL中,并通过互操作从WPF程序调用它。从长远来看,这可能更容易。