本文介绍了将消息发送到C#中的hwnd的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WPF应用程序和一个MFC应用程序.我想在他们之间进行两次交流.我可以在mfc应用程序中使用SendMessage将消息发送到WPF应用程序.在WPF应用程序中该如何做?

I have a WPF application and a MFC application. I want to do a two communication between them. I can use SendMessage in mfc application to send messages to WPF application. How can I do the same in WPF application?

推荐答案

如果可以在MFC中进行操作,那么也可以通过导入SendMessage API调用在C#中进行操作:

If you can do it in MFC, then you can do it in C# too by importing the SendMessage API call:

[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, StringBuilder lParam);

您可以在此链接中找到SendMessage的示例用法.

You can find sample usage of SendMessage in this link.

这篇关于将消息发送到C#中的hwnd的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 05:20