Checking for Active Status

static LRESULT

OnIdle(HWND hwnd)

{

HRESULT hRes;

// Only animate if we are the foreground app, we aren't suspended,

// and we have completed initialization.

if (fActive && !fSuspended && (NULL != lpd3dDevice))

{

hRes = AnimateScene();

if (FAILED(hRes))

{

FatalError(hwnd, IDS_ERRMSG_ANIMATESCENE, hRes);

return 0L;

}

hRes = DoFrame();

if (FAILED(hRes))

{

FatalError(hwnd, IDS_ERRMSG_RENDERSCENE, hRes);

return 0L;

}

}

return 0L;

}