我的 VB.NET 应用程序中的计时问题

发布于 2024-08-03 19:24:01 字数 253 浏览 3 评论 0原文

我编写了一个程序,打开一个应用程序,使线程休眠 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

琴流音 2024-08-10 19:24:01

当你延长时间值时会发生什么?不要选择 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文