Redrawing on Window Movement
static LRESULT 
OnMove(HWND hwnd, int x, int y) 
{ 
    int     xDelta; 
    int     yDelta; 
    HRESULT hRes; 
 
    // No action if the device has not yet been created or if we are 
    // suspended. 
 
    if ((NULL != lpd3dDevice) && !fSuspended) 
    { 
        // Update the destination rectangle for the new client position. 
 
        xDelta = x - rDstRect.left; 
        yDelta = y - rDstRect.top; 
 
        rDstRect.left   += xDelta; 
        rDstRect.top    += yDelta; 
        rDstRect.right  += xDelta; 
        rDstRect.bottom += yDelta; 
 
        // Repaint the client area. 
 
        hRes = DoFrame(); 
        if (FAILED(hRes)) 
        { 
            FatalError(hwnd, IDS_ERRMSG_RENDERSCENE, hRes); 
            return 0L; 
        } 
    } 
 
    return 0L; 
}