如何以编程方式关闭Windows Mobile设备 [英] How can I shutdown a Windows Mobile device programatically
本文介绍了如何以编程方式关闭Windows Mobile设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想以编程方式关闭使用Compact Framework 2.0,Windows Mobile 5.0 SDK的Windows Mobile设备。
此致
解决方案
从您的应用程序执行此操作可能不是一个好主意-该设备由于某种原因具有电源按钮,关闭该应用程序可能会导致用户感到困惑和沮丧。 / p>
如果必须这样做,并且使用的是Windows Mobile 5.0或更高版本,则可以P /调用退出WindowsEx 像这样:
[标志]
公共枚举ExitFlags
{
重新启动= 0x02,
关机= 0x08
}
[DllImport( coredll)]
public static extern int ExitWindowsEx(ExitFlags标志,保留为int);
...
ExitWindowsEx(ExitFlags.PowerOff,0);
I would like to programatically shutdown a Windows Mobile device using Compact framework 2.0, Windows mobile 5.0 SDK.
Regards,
解决方案
It probably not a great idea to do it from your app - the device has a power button for a reason and shutting down the app can cause user confusion and frustration.
If you must do it, and you are using Windows Mobile 5.0 or later, you can P/Invoke ExitWindowsEx like this:
[Flags]
public enum ExitFlags
{
Reboot = 0x02,
PowerOff = 0x08
}
[DllImport("coredll")]
public static extern int ExitWindowsEx(ExitFlags flags, int reserved);
...
ExitWindowsEx(ExitFlags.PowerOff, 0);
这篇关于如何以编程方式关闭Windows Mobile设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文