You set a DirectDraw object's focus and device windows by calling the IDirectDraw2::SetCooperativeLevel method, specifying the DDSCL_SETDEVICEWINDOW or DDSCL_SETFOCUSWINDOW flags. (The SetCooperativeLevel method also accepts the DDSCL_CREATEDEVICEWINDOW flag, for more information about this flag, see Default Device Windows.)
Note: Remember, setting the focus window and the device windows only applies if you will be taking full-screen exclusive access with multiple monitors. If you are only going to take exclusive access to the primary device and monitor, you can call SetCooperativeLevel as you always have (by specifying only the DDSCL_FULLSCREEN and DDSCL_EXCLUSIVE flags in the dwFlags parameter).
Setting the focus and device windows is a two-step process. After creating the DirectDraw object for a device, you must first set its focus window. The focus window is the same for all the DirectDraw objects in your application, and you set it by calling the SetCooperativeLevel method. For the call, the first parameter is the window handle of the window to receive keyboard messages, and second parameter is the DDSCL_SETFOCUSWINDOW flag.
After setting the DirectDraw object's focus window, you set the device window and the cooperative level (in this case, full-screen exclusive mode). You do this with another call to SetCooperativeLevel. When making the second call, the first parameter is the window handle of the window that DirectDraw will resize to fit the screen, and the second parameter is a combination of the DDSCL_SETDEVICEWINDOW, DDSCL_FULLSCREEN, and DDSCL_EXCLUSIVE flags.
Although you must specify a focus window that you created, you can allow DirectDraw to handle the creation and management of your device windows. For more information, see Default Device Windows.