Windows 7 - IDirectDraw7::SetCooperativeLevel() and focus/device window

Asked By Matthias Hofmann on 04-Feb-09 09:04 PM
Hello everyone!

I know that DirectDraw7 is rather outdated meanwhile, but I am working on a
large scale project that uses it, so I hope that someone can answer my

There are, among others, two flags that may be passed to
IDirectDraw7::SetCooperativeLevel(), which are DDSCL_SETFOCUSWINDOW and
DDSCL_CREATEDEVICEWINDOW. Although I spent quite a while searching for an
explanation of the meaning of these flags on the internet, all I found was
the information that an application may have a focus window to determine
whether it gains or loses the input focus, and that a device may have a
device window, which is somehow related to the back buffer.

My application is running with exclusive rights in full screen mode, i.e. I
am also passing the DDSCL_EXCLUSIVE as well as the DDSCL_FULLSCREEN flag.
But I am not quite sure whether I also need to specify the flags for the
focus window and the device window. Many tutorials I found do not seem to
use these flags. Can anyone please explain to me what's the deal with the
focus window and the device window? My call to
IDirectDraw7::SetCooperativeLevel() currently looks like this:

// Set the cooperative level.
if ( SUCCEEDED( hResult = lpDD7->SetCooperativeLevel(
// Return the result.
return hResult;

Is there anything wrong with it?

Matthias Hofmann
Anvil-Soft, CEO - The Creators of Toilet Tycoon - Die Macher des Klomanagers

PhilTaylo replied on 05-Feb-09 06:57 PM
do you have the DX7 SDK and doc-set?

the multimonitor space donuts sample will be very helpful if so. appears to have it available as
a download. may also be somewhat helpful.

Phil Taylor
somewhat D3D knowledgeable :-)
Matthias Hofmann replied on 06-Feb-09 03:32 PM
Ok, I am going to take a look at it, thank you! :-)

Matthias Hofmann
Anvil-Soft, CEO - The Creators of Toilet Tycoon - Die Macher des Klomanagers