How often have you closed the lid to your laptop and put it in the bag, only to reach in an hour later and feel a nice toasty machine with a nearly dead battery?
Here’s a little program to solve that problem. I call it “No, Really!”.
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
for (;;)
{
DWORD sleep = GetTickCount();
SetSuspendState(false, false, true);
DWORD wake = GetTickCount();
if (wake-sleep > 30000)
break;
}
return 0;
}