Inability to launch any Unreal programs due to "D3D device being lost"

try changing your monitor resolution, fullscreen to windowed or using nvidia studio driver.
and reduce the quality of the game or ue5.