如何检测 Windows Mobile 上的挂起? [英] How can I detect suspend on Windows Mobile?

查看:44
本文介绍了如何检测 Windows Mobile 上的挂起?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在 Windows Mobile 上看到我们的应用程序偶尔会丢失一些数据,我们怀疑在设备挂起时某些缓冲数据没有刷新到磁盘.我们想在设备即将挂起时手动将数据刷新到磁盘.在 Windows 上,我们通过捕获 WM_POWERBROADCAST 消息来实现这一点,但此消息在 Windows Mobile 上不可用.我在 留言板 说:

We are seeing some occasional data loss with our application on Windows Mobile, and we suspect that some buffered data is not being flushed to disk when the device is suspending. We would like to manually flush data to the disk when the device is about to suspend. On Windows, we do this by catching the WM_POWERBROADCAST message, but this message is not available on Windows Mobile. I found a two-year-old quote on a message board that said:

您需要意识到*不*保证您会在*再次醒来之前*收到暂停通知.也就是说,在设备被重新唤醒之前,您可能不会收到通知.一般来说,你不应该因为这个限制而试图对挂起做出反应(无论如何你可以对事件做出响应的限制).
You need to realize that you are *not* guaranteed that you will be notified of the suspend *before* you wake up again. That is, you might not receive the notification until after the device has been reawakened. Generally, you should not be trying to react to suspend because of this limitation (and the limitation on what you can do in response to the event, anyway).

这(仍然)适用于所有设备吗?有没有办法做到这一点?

Is this (still) true for all devices? Is there a way we can do this?

推荐答案

这句话(听起来真的很熟悉)仍然是正确的.唯一保证能够在挂起前完成工作的组件是驱动程序,它们也有一系列明显的限制.

The quote (which sounds really, really familiar) is still true. The only components that are guaranteed to be able to complete their work before suspend are drivers, and they have a significant set of limitations as well.

挂起背后的一般想法是对应用程序透明,在此之前通常不是一个好主意.

The general idea behind a suspend is to be transparent to the application, and getting in front of that generally isn't a good idea.

这篇关于如何检测 Windows Mobile 上的挂起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆