过程开始时中断 [英] Interrupt at Process start
问题描述
嘿伙计们,
我有一个有趣的查询,我想知道我们能做到这样的事情。
基本上,我有两种产品。让我们称他们为A.exe和B.exe
他们可以同时运行。但我想要实现的是,当A看到B正在运行时,我希望A进入集成模式,我进行一些GUI调整等,这样两个产品都可以在我身边运行。 />
第一种方法是运行一个线程并手动保持轮询进程以查看B.exe是否正在运行,如果它正在运行,则允许用户输入所请求的模式。
我不想那样,因为这会让我的程序有点太重,不管我喜欢什么,即使我每隔1-2秒轮询一次这个过程。
还有更好的方法吗?例如,有没有一种方法可以在我的计算机上每次启动新进程时在程序中设置一个中断,如果该进程是B.exe,我可以进行所需的GUI调整?任何人都可以给我一个关于如何实现这一目标的提示吗?
Hey guys,
I have an interesting query, I wonder if there is something like this we can do.
Basically, I have two products. Lets call them A.exe and B.exe
They can ofcourse run simultaneously. But what I want to implement is that when A "sees" that B is running, I want A to enter an "integrated" mode, whereby I do some GUI adjustment, etc, so that both products can run side my side.
The first method would be to run a thread and manually keep polling the processes to see if B.exe is running, if it is running, allow the user to enter the requested mode.
I don''t want that, as this would make my program a bit too heavy for my liking, even if I poll the processes every 1-2 seconds.
Is there a better way to do this? For instance, is there a way that I could set up an interrupt in the program everytime a new process is started on my computer, and if that process is B.exe, I can do the required GUI adjustment? Can anyone give me a hint as to how I can go about to achieve this?
推荐答案
从用户模式中,您无法获得流程启动的任何事件通知。如果流程B是您的,那么您可以考虑一些进程间通信机制来实现这一目标。
From user mode you can’t get any event notification for process launch. If the process B is yours, then you can think about some Inter Process Communication mechanisms to achieve this.
这篇关于过程开始时中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!