Platform SDK: DirectX

DirectSound.SetCooperativeLevel

The DirectSound.SetCooperativeLevel method sets the cooperative level of the application for this sound device.

object.SetCooperativeLevel(hwnd As Long, _
    level As CONST_DSSCLFLAGS)

Parameters

object
Object expression that resolves to a DirectSound object.
hwnd
Window handle to the application. See Remarks.
level
Requested priority level. Must be a constant of the CONST_DSSCLFLAGS enumeration.

Error Codes

If the method fails, an error is raised and Err.Number may be one of the following error values.

DSERR_ALLOCATED
DSERR_INVALIDPARAM
DSERR_UNINITIALIZED
DSERR_UNSUPPORTED

Remarks

The application must set the cooperative level by calling this method before its buffers can be played. The recommended cooperative level is DSSCL_PRIORITY; use other priority levels when necessary.

The hwnd parameter should be the top-level application window handle. If you are also using DirectDraw, it must be the same handle passed to the DirectDraw7.SetCooperativeLevel method.