Shortest app yet – Windows Mobile reset

I have to reset my Windows Mobile PDAs depressingly often. Both the HTC Universal and Advantage seem to need resetting every other day or so.

This has one big problem. You can lose stuff if you’re not careful. From Windows Mobile 5 onwards, a lot of data is kept in memory for performance reasons – written to persistent storage periodically. If you reset before this has been done, you can lose the most recent data.

For example, if I get a text message, then reset the phone, that text message will almost certainly be lost.

The trick is, if you need to do a reset you switch the phone off, leave it for 20 seconds then reset it. Normally, after being idle for a bit the phone will write pending data to storage.

This is a bit unscientific, so (after losing stuff from Outlook again today) I looked for a software way to ensure recent stuff is saved.

Here is what I ended up with – my shortest app yet 🙂

#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>
#include <aygshell.h>

int _tmain(int argc, _TCHAR* argv[])
{
    if (MessageBox(NULL, 
                   TEXT("Really reset?"), 
                   TEXT("Reboot"), 
                   MB_YESNO) == IDYES)
    {
        ExitWindowsEx(EWX_REBOOT, 0);
    }
    return 0;
}

Comments are closed.