我的 VB.NET 应用程序中的计时问题
我编写了一个程序,打开一个应用程序,使线程休眠 500 毫秒,然后拍摄框架句柄的照片。我对大约 600 个文件执行此操作。奇怪的是,每 40 个左右的文件,process.kill() 就不起作用或其他什么,因为应用程序挂起,而正在运行的文件程序正在运行,而它应该被杀死,然后我的程序在尝试启动过程。在我的慢速笔记本电脑上,大约每 60 次就会崩溃,在我的快速 Quadro 上,大约每 30 次就会崩溃。什么可能导致这种情况?我不明白如何跳过一个程序;奇怪......
谢谢
I made a program that opens an application, sleeps the thread for 500ms then takes a picture of the frame's handle. I do this to about 600 files. Oddly enough, every 40 or so files, the process.kill() doesnt work or something, because the application hangs, and the running files program is running, when it should have been killed, then my program crashes when it tries to start the process. On my slow laptop, it crashes every 60 or so, on my fast quadro, every 30 or so. What could cause this? I dont see how a procedure could be skipped; odd....
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当你延长时间值时会发生什么?不要选择 500 毫秒,而是尝试 2-4 秒。此外,尝试使用 WaitForExit 以便检测应用程序是否挂起。
What happens when you lengthen your timing values? Instead of 500ms, try 2-4 seconds. Additionally, try using WaitForExit so you can detect if the application is hanging.