The IDirectDraw2::SetCooperativeLevel method determines the top-level behavior of the application.
HRESULT SetCooperativeLevel(
HWND hWnd,
DWORD dwFlags
);
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_CREATEDEVICEWINDOW | |
This flag is supported in Windows 98 and Windows NT 5.0 only. Indicates that DirectDraw is to create and manage a default device window for this DirectDraw object. For more information, see Default Device Windows. | |
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. | |
DDSCL_SETDEVICEWINDOW | |
This flag is supported in Windows 98 and Windows NT 5.0 only. Indicates that the hWnd parameter is the window handle of the device window for this DirectDraw object. This flag cannot be used with the DDSCL_SETFOCUSWINDOW flag. | |
DDSCL_SETFOCUSWINDOW | |
This flag is supported in Windows 98 and Windows NT 5.0 only. Indicates that the hWnd parameter is the window handle of the focus window for this DirectDraw object. This flag cannot be used with the DDSCL_SETDEVICEWINDOW flag. |
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 |
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.
Windows NT: Use version 4.0 or later.
Windows: Use Windows 95 or later. Available as a redistributable for Windows 95.
Windows CE: Unsupported.
Header: Declared in ddraw.h.
Import Library: Use ddraw.lib.
IDirectDraw2::SetDisplayMode, IDirectDraw2::Compact, IDirectDraw2::EnumDisplayModes, Mode X and Mode 13 Display Modes, Focus and Device Windows, Default Device Windows.