How do I reboot WinCE device? ExitWindowEx ? I cannot find any API to use.
thanks for any help,
Avex
You never really exit windows, but you can reset the hardware, and restart
the operating system.
Just make sure you add the code to close all running applications if you
don't want the user to lose any data.
extern "C"
{
#include <winioctl.h>
BOOL KernelIoControl(DWORD, LPVOID, DWORD, LPVOID, DWORD, LPDWORD );
#define IOCTL_HAL_REBOOT CTL_CODE(FILE_DEVICE_HAL, 15, METHOD_BUFFERED,
FILE_ANY_ACCESS)
}
void SoftReset ()
{
// try Windows CE <= 3.0 reset method
KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);
// if failed, try the Windows >= CE 4.0 specific method
SetSystemPowerState (NULL, POWER_STATE_RESET, 0);
}
The first method goes through the HAL, asking OEM code to perform a reboot.
The second method uses the WinCE 4 power manager, newer devices might not be
able to reset themselves from the HAL, the power manager is at a higher
level and can communicate with more hardware (I know at least one device
which control its reboot through I2C, and cannot perform the reboot from the
HAL).
--
Philippe Majerus
http://www.phm.lu
--
Steve Maillet
EmbeddedFusion
www.EmbeddedFusion.com
smaillet at EmbeddedFusion dot com
Thanks, it works!