[英]Cross-process interaction under C++
Please help, how can I organize the process-process data exchange (in Windows, if that matters)? 请帮忙,我如何组织流程 - 流程数据交换(在Windows中,如果重要)?
I have process1.exe
which calls process2.exe
with a few command line arguments. 我有
process1.exe
这就要求process2.exe
有一些命令行参数。 I want to track "progress" of process2
from process1
(say, some int
value). 我想跟踪的“进步”
process2
从process1
(比如说,有的int
值)。 It (that int
value) can be accessed from process1
permanently or each X ms - doesn't matter. 它(
int
值)可以从process1
永久访问,或者每个X ms - 无关紧要。
Will be useful any solution: WinApi or Qt. 将是有用的任何解决方案:WinApi或Qt。
Thank you everybody! 谢谢大家! All answers are very useful!
所有答案都非常有用! :) Many thanks!!
:) 非常感谢!!
OTOH: OTOH:
Pick one - Windows messages or shared memory may be the easier ones. 选择一个 - Windows消息或共享内存可能更容易。
There are many options here: 这里有很多选择:
There are several methods: 有几种方法:
The issue is that Process2 will be broadcasting and Process1 will be listening. 问题是Process2将进行广播,Process1将进行监听。 Process1 will need to know when Process2 is finished and maybe the percentage complete.
Process1需要知道Process2何时完成,可能还有完成的百分比。
I believe Sockets would be the better route, but that depends on the application, development schedule and familiarity of concepts. 我相信套接字将是更好的途径,但这取决于应用程序,开发时间表和概念的熟悉程度。
您只需使用Windows Api(SendMessage)发送消息即可。
An obvious omission in the options presented so far is COM. 到目前为止,在选项中明显遗漏的是COM。 I'm expecting the usual flurry of "COM is crap" responses, but in my experience this hasn't been the case.
我期待通常的“COM是废话”反应,但根据我的经验,情况并非如此。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.