Releasing the Direct3D Object

The ReleaseDirect3D function releases the DirectDraw (Direct3D) driver object.

static HRESULT 
ReleaseDirect3D(void) 
{ 
    if (NULL != lpd3d) 
    { 
        lpd3d->lpVtbl->Release(lpd3d); 
        lpd3d = NULL; 
    } 
    if (NULL != lpdd) 
    { 
        lpdd->lpVtbl->Release(lpdd); 
        lpdd = NULL; 
    } 
 
    return DD_OK; 
}