The problem with mentioned example is probably related to Nvidia Hardware. On ATI this example works perfectly. But on Nvidia cards, "Present" method in Direct3D returns "D3DERR_DRIVERINTERNALERROR". Manual explains:
"If D3DERR_DRIVERINTERNALERROR happens during 3-D rendering, the runtime returns it at the IDirect3DDevice9:resent call. The application can do one of the following:
End, with the pop-up window saying that the application cannot continue because of problems in the display adapter and that the user should contact the adapter manufacturer.
Attempt to restart by calling IDirect3DDevice9::Reset, which is essentially the same path as recovering from a lost device. If IDirect3DDevice9::Reset fails with D3DERR_DRIVERINTERNALERROR, the application should end immediately with the message that the user should contact the adapter manufacturer." Oh well...