IDirectDraw::SetCooperativeLevel

Send Feedback

This method determines the top-level behavior of the application.

HRESULT SetCooperativeLevel(
  HWND hWnd, 
  DWORD dwFlags
); 

Parameters

  • hWnd
    Window handle used for the application. Set to the calling application's top-level window handle (not a handle for any child windows created by the top-level window). This parameter can be NULL when the DDSCL_NORMAL flag is specified in the dwFlags parameter.
  • dwFlags
    The following table shows the possible flags.
    Flag Description
    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.

    The current Windows CE implementation allows for processes with NORMAL level to access DirectDraw resources when there is a process in full-screen exclusive mode.

    Processes in NORMAL mode can access primary surfaces but are restricted with regard to flipping, creating complex primaries, and setting display modes.

    A process may go into full-screen exclusive mode if no other process is in exclusive mode, regardless of whether processes are running at a NORMAL level of cooperation.

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_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_OUTOFMEMORY

Remarks

This method must be called by the same thread that created the application window.

Interaction between this method and the IDirectDraw::SetDisplayMode method differs from their IDirectDraw counterparts.

Developers using Microsoft Foundation Classes (MFC) should keep in mind that the window handle passed to this method should identify the application's top-level window, not a derived child window.

To retrieve your MFC application's top level window handle, use the following code.

    HWND hwndTop = AfxGetMainWnd()->GetSafeHwnd();

Requirements

Pocket PC: Windows Mobile 5.0 and later
Smartphone: Windows Mobile 5.0 and later
OS Versions: Windows CE 5.01 and later
Header: Ddraw.h.
Library: Ddraw.lib.

See Also

IDirectDraw::SetDisplayMode | IDirectDraw::EnumDisplayModes

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.