Direct Input 8

What do the options mean?

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.

You might also like...

Comments

About the author

David Nishimoto United States

NishiSoft provides Part I of the Information Technology Project collaboration. Sign up and list your IT project tasks, assign task too friends, and get percent complete task.

Part will ...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perl - The only language that looks the same before and after RSA encryption.” - Keith Bostic