Call the IDirect3D3::CreateViewport method to create the viewport object. For this you need a valid LPDIRECT3D3 pointer, shown in the following example as lpD3D2:
HRESULT hr;
hr = lpD3D3->CreateViewport(&lpD3DViewport3, NULL);
if(FAILED(hr))
return hr;
else
{
// Add the viewport to a device.
}
After creating a viewport, you can add it to an existing device. For more information, see Adding a Viewport to a Device.