Q: Can my application determine can it determine if the device was soft or hard reset?
When Windows CE restarts through a soft-reset the following registry key is incremented:
HKEY_LOCAL_MACHINE/Comm/BootCount
After a hard-reset, the value will be 1. Any number greater than 1 signifies a soft reset has occurred. You can query this value like this:
HKEY hKey;
DWORD type;
DWORD size;
DWORD bootcount;
size = 4;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Comm"), 0, 0, &hKey);
RegQueryValueEx(hKey, _T("BootCount"), 0, &type, (unsigned char *)&bootcount, &size);
RegCloseKey(hKey);
if(bootcount > 1)
{
// soft reset
}
else
{
// hard reset
}
-----------------
Chris Tacke, eMVP
Applied Data Support