C# code to soft reset a Windows Mobile device

Here is the C# code to soft reset a Windows Mobile device (using P/Invoke)

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

const int POWER_FORCE = 4096;
const int POWER_STATE_RESET = 0x00800000;

private void SoftReset()
{
SetSystemPowerState(null, POWER_STATE_RESET, POWER_FORCE);
}

Leave a Comment