简体   繁体   English

.Net中的ActiveX控件检测到应用程序挂起

[英]Detecting application hangs with ActiveX controls in .Net

I am working on upgrades to a screen scraping application. 我正在努力升级屏幕抓取应用程序。 We are using an ActiveX control to scrape screens out of an IBM mainframe. 我们正在使用ActiveX控件从IBM大型机上刮取屏幕。 The mainframe program often hangs and crashes the ActiveX control causing our application to crash. 大型机程序经常挂起并导致ActiveX控件崩溃,从而导致我们的应用程序崩溃。 We don't have access to the mainframe or the ActiveX source code. 我们无权访问大型机或ActiveX源代码。 We are not going to write our own active x control. 我们不会编写自己的活动x控件。

What is the bast way to encapsulate an ActiveX control to detect application hangs with the control so we can kill the process and restart with code? 封装ActiveX控件以检测应用程序是否挂起的最有效方法是什么,以便我们可以杀死该进程并重新启动代码?

Should I create 2 separate applications? 我应该创建两个单独的应用程序吗? One as a controller that checks on the other and kills/restarts the process when it hangs? 一个作为控制器检查另一个,并在挂起时终止/重新启动该进程?

Would they have to be on separate app domains? 他们必须在单独的应用程序域中吗? Is it possible have two programs communicate with each other even if they are on separate app domains? 即使两个程序位于单独的应用程序域中,它们是否也可能彼此通信?

You can start an executable with System.Diagnostics.Process.Start(). 您可以使用System.Diagnostics.Process.Start()启动可执行文件。 This returns a Process object with a Responding property that you can use to check periodically if the process is still active. 这将返回具有Responding属性的Process对象,您可以使用该属性定期检查该进程是否仍处于活动状态。

You'll need two separate applications to do this though. 但是,您将需要两个单独的应用程序来执行此操作。 And the application you're monitoring needs to have a main window because the monitoring works by checking if the application still processes messages from the main-window messagequeue. 而且您正在监视的应用程序需要有一个主窗口,因为监视通过检查应用程序是否仍在处理来自主窗口消息队列的消息来进行。 This is the same way windows knows to add "Not responding" to a window-title 这与Windows知道向窗口标题添加“不响应”的方式相同

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM