开发者

Is it possible to connect or make calls to an existing process?

In Windows, I currently have two programs working as follow. Program A calls Program B with some parameters, which causes Program B to return some text then exits. Program A calls Program B again with other parameters, which causes Program B to do more things.

When Program B starts, it needs to do some time consuming loading. The method above means Program B has to do the loaded twice. Is it possible to load Program B only once?

e.g. Program A calls Program B with some parameters, which causes Program B to return some text, but the program continues to run. Program A calls the same process again, which causes Program B to do more things.

Is the above possible, perhaps using some sort of Windows messen开发者_如何学JAVAging? Program A is a Delphi app, uses Windows' CreateProcess method. Program B is a .NET app that does various things according to the parameters passed in. I know we can do this by installing Program B as a Windows service, but I would like to avoid that if possible.


Here comes the technologies for inter process communication. .NET has WCF/webservices etc to do this. The service can be hosted using an executable (even a console app) or as an windows service. You can choose the webserver (IIS) also.

As your program B is in .NET, you can host it as a service and consume it in Delphi application. I don't know for what purpose, you wish to avoid it a a service. But this will positively give you an upper hand and the implementation is fairly simple.

Even in case you are using C/C++ etc, you can think of serving the program B as an webservice using wrappers like gSOAP.


We ended up creating Program B that has an invisible form so it runs continously. Program A sends a Windows message to Program B whenever it needs work to be done. When Program A quits, it sends a 'Quit' message to Program B, Program B sees the message and quits as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜