All Forums
 Microsoft Windows CE
 eVC Application Development
 Determining if the device is soft or hard reset
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

ctacke

877 Posts

Posted - 19 Aug 2002 :  13:38:12  Show Profile  Email Poster
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
  Topic  
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Jump To:
Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
This page was generated in 0.02 seconds. Snitz Forums 2000