Focus and Device Windows

In a single monitor system, when you set the full-screen exclusive cooperative level for an application (by calling IDirectDraw2::SetCooperativeLevel), you must specify your application's window handle. DirectDraw uses the application's window handle to hook the system messages it needs to gather information about the application's state, to forward keyboard input messages, and to resize the window to cover the entire screen. DirectDraw doesn't require a window handle for the normal cooperative level.

Multiple monitor systems necessarily have more than one installed display device and, therefore, to access multiple devices using DirectDraw, you must create a DirectDraw object for each display device you plan to use. However, each DirectDraw object that you create needs to know which of the application windows is the one it can resize, and which one is supposed to receive keyboard messages. In other words, applications need some way to tell DirectDraw which windows are to be used for what operations. This capability is provided through the concepts of the focus window and the device window. The IDirectDraw2::SetCooperativeLevel method supports three flags to communicate this information to a DirectDraw object: DDSCL_SETFOCUSWINDOW, DDSCL_SETDEVICEWINDOW, and DDSCL_CREATEDEVICEWINDOW.

A device window is simply a visible window that DirectDraw can resize to fill the display area of a monitor. You can manually create as many device windows as installed display devices, or you can let DirectDraw handle these details for you. (There are some trade-offs involved when you let DirectDraw manage the creation of device windows, these trade-offs are discussed in Default Device Windows.)

A focus window is the window to which a DirectDraw object forwards keyboard input messages. A DirectDraw application can only have one focus window.

For more information, see Setting Focus and Device Windows and Default Device Windows.