如何链接两个.exe的 [英] how to link two .exe's

查看:68
本文介绍了如何链接两个.exe的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



我有一个小的Windows应用程序,它作为另一个应用程序的宏运行。我在宏中使用system.diaognastic.process.start(app.exe)调用此应用程序。我的问题是每当点击主应用程序或用户在主应用程序上执行任何操作时,这个小表单会自动最小化,如何避免这种情况?如果主要应用程序关闭或最小化,小形式也应该关闭...



注意: - 我正在调用.exe,而不是使用.dll



感谢您的帮助....

解决方案

一旦开始流程,您就会失去与它的沟通在某种程度上:你确实得到了一个ProcessID,你可以从中获取窗口句柄等等,这样你就可以发送窗口消息来最小化,关闭等等 - 但更好的想法是设置正确的通信在两个进程之间允许它们相互通信并直接告诉它们该做什么。

这很简单:只需打开一个套接字并开始传递指令。

1.-尝试在被调用的应用程序中设置TopMost = true

2.-你必须将你正在调用的进程存储在一个Process变量中,并在你的主表单中关闭它:



过程p; 
p = Process.Start( notepad.exe);




// 在FormClosing事件处理程序中
p.Kill();


hello

i have a small windows application which is running as a macro for another application. i am calling this application using system.diaognastic.process.start(app.exe) in the macro. my problem is whenever the main application is clicked or whenever the user performs any operation on the main application this small form is automatically minimized,how to avoid this ?? and also if the main application is closed or minimized the small form should also be closed...

Note:- i am calling .exe, not using .dll

thanks for help....

解决方案

Once you start a process, you lose communications with it to an extent: you do get a ProcessID from which you can get the window handles and so forth which would allow you to send windows messages to minimize, close, and so forth - but a better idea would be to set up "proper" communications between the two processes to allow them to talk to each other and tell them directly what to do.
That would be pretty easy: just open a socket and start passing instructions.


1.- Try setting TopMost=true in your called application
2.- You have to store the process you are calling in a Process variable, and the in your main form closing kill it:

Process p;
p=Process.Start("notepad.exe");

.
.
.
//In your FormClosing Event Handler
            p.Kill();


这篇关于如何链接两个.exe的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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