Foreground
Foreground cooperative level means that the application has access to data only when in the foreground
or, in their words, has the input focus. If the application moves to the background, the device is automatically
unacquired, or made unavailable.
Background
Background cooperative level really means foreground and background. A device with a background cooperative
level can be acquired and used by an application at any time.
Exclusive
Exclusive mode prevents other applications from also acquiring the device exclusively. The fact that
your application is using a device at the exclusive level does not mean that other applications cannot
get data from the device. When an application has exclusive access to the keyboard, DirectInput suppresses
all keyboard messages including the Windows key except CTRL+ALT+DEL and, on Windows 95 and Windows 98,
ALT+TAB.
Nonexclusive
Nonexclusive mode means that other applications can acquire device in exclusive or nonexclusive mode.
DisableWindowKey
The Windows key will also be disabled so that users cannot inadvertently break out of the application.
Immediate
Immediate data is a snapshot of the current state of a device. It provides no data about what has
happened with the device since the last call, apart from implicit information that you can derive by
comparing the current state with the last one. Events in between calls are lost.
Buffered
Buffered data is a record of events that are stored until an application retrieves them. With buffered
data, events are stored until you are ready to deal with them. If the buffer overflows, new data is
lost.
The sample will read the keyboard 12 times a second. Typically an application would poll the keyboard
much faster than this, but this slow rate is simply for the purposes of demonstration.
Comments