跨计算机的Windows消息:有可能吗? [英] Windows messages across computers: Is it possible?

查看:99
本文介绍了跨计算机的Windows消息:有可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以将Window消息(例如WM_COPYDATA)发送或发布到同一网络上不同计算机上运行的应用程序。我想答案是不,但如果有人有不同的经验,请告诉 - 并说明我如何获得该过程的窗口句柄。



背景是我必须控制通过WM_COPYDATA接受命令的第三方应用程序。这个应用程序是一台机器的一部分,并配有自己的PC,我宁愿不妨碍该PC的配置。我目前的解决方案是运行一个中间应用程序,它从控制应用程序接收数据并通过WM_COPYDATA将其转发到第三方应用程序,但是这个中间应用程序仍然必须在第三方PC上运行。



感谢您的任何评论。

I wonder whether it is possible to send or post a Window message, such as WM_COPYDATA, to an application that is running on a different computer on the same network. I guess the answer is "no" but if someone has different experience, please tell - and say how I can get a window handle for that process.

The background is that I must control a 3rd party application that accepts commands via WM_COPYDATA. This application is part of a machine and comes along with its own PC, and I'd rather not hamper with the configuration of that PC. My current solution is to run an intermediate application that receives data from the control application and forwards it to the 3rd party app via WM_COPYDATA, but this intermediate application must still run on the 3rd party PC.

Thank you for any comments.

推荐答案

没有。当然,你可以用某种网络传输创建一些桥/隧道,但我会告诉你:它没有任何实际意义。



原因如下:



即使您可以在同一台计算机上的进程之间交换Windows消息,这也是奇怪的历史工件。故事开始于基于MS-DOS的Windows版本。那些版本不是操作系统,它们是DOS上的图形外壳。后来,英特尔80386的保护模式被使用(由于一些众所周知的限制,它在80286上没有成功)。即便如此,Windows(Windows 95)仍然是一个shell;并且保护模式的使用具有非常弱的保护。用户仍然可以访问其他进程的内存。



同时,创建了Windows NT(和新技术),其中进程被严格隔离。他们开始有独立的地址空间。但是,为了与旧的Windows API兼容,仍然可以通过旧的旧Windows消息进行数据交换。这与主导的操作系统架构原则相矛盾。我想,微软很难再现这种遗留行为。总的来说,与Windows消息的交换是一个死胡同。使用它在技术上是可行的,但是你无处可去。



使用正常的网络方法,从套接字到.NET远程处理,WCF,其他消息传递API。



-SA
No. Of course, you can create some bridge/tunnel with some kind of network transport, but I'll tell you: it makes no practical sense.

Here is why:

Even the fact that you can exchange Windows messages across processes on the same computer, is the very weird historical artifact. The story started with the versions of Windows bases on MS-DOS. Those versions were not OS, they were the graphical shells over DOS. Later on, protected mode of Intel 80386 was uses (by a number of well-known limitations, it was not successful on 80286). Even then, Windows (Windows 95) was still a shell; and the protected mode was uses with a very weak protection. The user still could access the memory of other processes.

In parallel, Windows NT (and New Technology) was created, where the processes were strictly isolated. They started to have separate address spaces. Still, for compatibility with old Windows API, data exchange through old legacy Windows messages remains possible. This contradicts to the dominating OS architectural principles. I guess, Microsoft had hard time to reproduce this legacy behavior. Overall, exchange with Windows messages is a dead end. Using it is technically possible but will take you nowhere.

Use normal networking approaches, from sockets to .NET remoting, WCF, other messaging APIs.

—SA


这篇关于跨计算机的Windows消息:有可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆