windows-mobile – 如何以编程方式关闭Windows Mobile设备

前端之家收集整理的这篇文章主要介绍了windows-mobile – 如何以编程方式关闭Windows Mobile设备前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想使用Compact framework 2.0,Windows mobile 5.0 SDK以编程方式关闭Windows Mobile设备.

问候,

从您的应用程序中执行此操作可能不是一个好主意 – 设备有一个电源按钮是有原因的,关闭应用程序可能会导致用户混淆和沮丧.

如果您必须这样做,并且您使用的是Windows Mobile 5.0或更高版本,则可以像这样P / Invoke ExitWindowsEx

[Flags]
public enum ExitFlags
{
  Reboot = 0x02,PowerOff = 0x08
}

[DllImport("coredll")]
public static extern int ExitWindowsEx(ExitFlags flags,int reserved);

...

ExitWindowsEx(ExitFlags.PowerOff,0);
原文链接:https://www.f2er.com/windows/371770.html

猜你在找的Windows相关文章