### IDirectDrawSurface3::SetClipper

The IDirectDrawSurface3::SetClipper method attaches a DirectDrawClipper object to a DirectDrawSurface object.

HRESULT SetClipper(

LPDIRECTDRAWCLIPPER lpDDClipper

);

##### Parameters

lpDDClipper
  Address of the DirectDrawClipper structure representing the DirectDrawClipper object that will be attached to the DirectDrawSurface object. If this parameter is NULL, the current DirectDrawClipper object will be detached.

##### Return Values

If the method succeeds, the return value is DD_OK.

If the method fails, the return value may be one of the following error values:

DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_INVALIDSURFACETYPE
DDERR_NOCLIPPERATTACHED

##### Remarks

This method is primarily used by surfaces that are being overlaid on or blitted to the primary surface. However, it can be used on any surface. After a DirectDrawClipper object has been attached and a clip list is associated with it, the DirectDrawClipper object will be used for the IDirectDrawSurface3::Blt, IDirectDrawSurface3::BltBatch, and IDirectDrawSurface3::UpdateOverlay operations involving the parent DirectDrawSurface object. This method can also detach a DirectDrawSurface object's current DirectDrawClipper object.

If this method is called several times consecutively on the same surface for the same DirectDrawClipper object, the reference count for the object is incremented only once. Subsequent calls do not affect the object's reference count.

##### See Also

IDirectDrawSurface3::GetClipper