将WAP配置更新推送到Windows Mobile设备时,是否可以禁止重新启动请求消息?

时间:2011-11-08 14:42:16

标签: configuration windows-mobile

我们的自动维护程序会在一夜之间向我们的设备发送这样的配置更新:

<wap-provisioningdoc>
    <characteristic type="SoftwareDisable">
        <characteristic type="DisabledSystemFiles">
            <parm name="Labyrinth.exe" />
        </characteristic>
    </characteristic>
</wap-provisioningdoc>

这样可以正常工作,除了它弹出一个框,询问用户是否要立即重启或更晚,特别是:

Restart

Recent changes to your device require a 
restart. During this process you cannot make 
or receive phone calls, including emergency 
calls. Restart your device now? 

Now                             Later

这当然很难做到,因为没有用户,只有自己坐在那里的机架和机架。

那么,有没有办法不弹出这个消息,只是自动重启设备?可能是一些注册表设置或什么?

1 个答案:

答案 0 :(得分:1)

您可以通过代码软重置设备。

只需要p / invoke

  public enum SystemPowerStates : uint
    {
        /// <summary>
        /// On state.
        /// </summary>
        On = 0x00010000,

        /// <summary>
        /// No power, full off.
        /// </summary>
        Off = 0x00020000,

        /// <summary>
        /// Critical off.
        /// </summary>
        Critical = 0x00040000,

        /// <summary>
        /// Boot state.
        /// </summary>
        Boot = 0x00080000,

        /// <summary>
        /// Idle state.
        /// </summary>
        Idle = 0x00100000,

        /// <summary>
        /// Suspend state.
        /// </summary>
        Suspend = 0x00200000,

        /// <summary>
        /// Reset state.
        /// </summary>
        Reset = 0x00800000
    }

    [DllImport("coredll.dll")]
    internal static extern int SetSystemPowerState(string psState, int StateFlags, int Options);



    /// <summary>
    /// Defines the System power requirement flags
    /// </summary>
    public enum PowerReqFlags : uint
    {
        POWER_NAME = 0x00000001,
        POWER_FORCE = 0x00001000,
    }

并调用函数SetSystemPowerState,我将它用在另一个方法中。

 private static void DeviceReset()
    {
        SetSystemPowerState(
                            null,
                            (int)SystemPowerStates.Reset,
                         (int)PowerReqFlags.POWER_FORCE);
    }