Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/128.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 用C语言向hwnd发送消息#_C++_Wpf_Mfc_Sendmessage - Fatal编程技术网

C++ 用C语言向hwnd发送消息#

C++ 用C语言向hwnd发送消息#,c++,wpf,mfc,sendmessage,C++,Wpf,Mfc,Sendmessage,我有一个WPF应用程序和一个MFC应用程序。我想在他们之间做两次交流。我可以在mfc应用程序中使用SendMessage向WPF应用程序发送消息。如何在WPF应用程序中执行相同的操作?如果可以在MFC中执行,那么也可以通过导入SendMessage API调用在C中执行: [DllImport("user32.dll", CharSet = CharSet.Auto)] static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPt

我有一个WPF应用程序和一个MFC应用程序。我想在他们之间做两次交流。我可以在mfc应用程序中使用SendMessage向WPF应用程序发送消息。如何在WPF应用程序中执行相同的操作?

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

[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, StringBuilder lParam);
您可以在中找到SendMessage的示例用法。

Just pinvoke SendMessage()。请考虑一个更好的捕鼠器,比如命名管道或套接字,在WPF应用程序中更容易找到另一端,更容易使用。