如何让程序在待机后继续运行?

发布于 2024-12-07 09:48:25 字数 264 浏览 0 评论 0原文

我编写了一个非常简单的 .Net Windows 应用程序,它位于系统托盘中,每 15 分钟查询一次数据库。它运行良好,没有任何问题,除非计算机进入待机模式。用户重新唤醒计算机后,系统托盘中的图标消失,程序不再运行。

如何才能使程序在待机或休眠后继续运行?由于这是一个公司环境,我对盒子设置几乎没有控制权,但如果有办法通过代码来做到这一点,我可以对程序本身进行更改。

操作系统是 XP - 一些很快就会升级到 Windows 7。 我使用的是 Visual Studio 2005。

I wrote a very simple .Net windows application that sits in the system tray and queries a db every 15 minutes. It works great without any issues, except when the computer goes into standby mode. After the user wakes the computer back up, the icon in the system tray is gone, and the program is no longer running.

How can I make it so that the program continues running after a standby or hibernate? I have very little control over the box settings since this is a corporate environment, but I could make changes to the program itself if there is a way to do this through code.

The OS is XP - some will be upgraded to Windows 7 soon.
Im using Visual Studio 2005.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

绾颜 2024-12-14 09:48:25

如果它在系统挂起期间运行,它已经在系统挂起后运行!您的应用程序可能会在开始唤醒后或暂停之前退出。

这可能是崩溃,但这会显示一条信息丰富的错误消息。

您需要跟踪应用程序的执行(即日志系统),然后找到问题并修复它。也许网络连接可能是故障点,但不确定:数据库连接在备用后仍然有效?

It already runs after a system suspension, if it was running during the suspend! Probably, you application exits after having started the wake up or just before the suspension.

It could be a crash, but this would show an informative error message.

You need to track the application execution (i.e. A log system), then find the problem and fix it. Maybe the network connnection could be the point of failure, but not sure: the DB connection is still valid after a standby?

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