IDirectDraw2::SetCooperativeLevel

The IDirectDraw2::SetCooperativeLevel method determines the top-level behavior of the application.

HRESULT SetCooperativeLevel(

HWND hWnd,

DWORD dwFlags

);

Parameters
hWnd
Window handle used for the application. This parameter can be NULL when the DDSCL_NORMAL flag is specified in the dwFlags parameter.
dwFlags
One or more of the following flags:
DDSCL_ALLOWMODEX
Allows the use of Mode X display modes. This flag must be used with the DDSCL_EXCLUSIVE and DDSCL_FULLSCREEN flags.
DDSCL_ALLOWREBOOT
Allows CTRL+ALT+DEL to function while in exclusive (full-screen) mode.
DDSCL_EXCLUSIVE
Requests the exclusive level. This flag must be used with the DDSCL_FULLSCREEN flag.
DDSCL_FULLSCREEN
Indicates that the exclusive-mode owner will be responsible for the entire primary surface. GDI can be ignored. This flag must be used with the DDSCL_EXCLUSIVE flag.
DDSCL_NORMAL
Indicates that the application will function as a regular Windows application. This flag cannot be used with the DDSCL_ALLOWMODEX, DDSCL_EXCLUSIVE, or DDSCL_FULLSCREEN flags.
DDSCL_NOWINDOWCHANGES
Indicates that DirectDraw is not allowed to minimize or restore the application window on activation.

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_EXCLUSIVEMODEALREADYSET
DDERR_HWNDALREADYSET
DDERR_HWNDSUBCLASSED
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_OUTOFMEMORY

Remarks

An application must set either the DDSCL_EXCLUSIVE or DDSCL_NORMAL flag.

The DDSCL_EXCLUSIVE flag must be set to call functions that can have drastic performance consequences for other applications. For more information, see Cooperative Levels.

Interaction between this method and the IDirectDraw2::SetDisplayMode method differs from their IDirectDraw counterparts. For more information, see Cooperative Levels and Display Modes with IDirectDraw2.

See Also

IDirectDraw2::SetDisplayMode, IDirectDraw2::Compact, IDirectDraw2::EnumDisplayModes, Mode X and Mode 13 Display Modes.