FORMAT:
less important.
**important.**
<span style="color:#e53333;">important.</span>
**<span style="color:#e53333;">very important.</span>**
<span style="color:#cc33e5;"><span style="color:#000000;"><span style="color:#ee33ee;">a little don't </span><span style="color:#ee33ee;">understand</span></span><span style="color:#ee33ee;">.</span></span>
<span style="color:#00d5ff;">can't understand.</span>
**<span style="background-color:#e53333;">Functions and Structures</span>**
Reference:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee418998(v=vs.85).aspx
Introduction to DirectInput {#TopicTitle style=”padding-bottom:35px;widows:2;text-transform:none;text-indent:0px;margin:0px;font:36px ‘Segoe UI Light’, ‘Segoe UI’, ‘Lucida Grande’, Verdana, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;letter-spacing:normal;color:#707070;word-spacing:0px;padding-top:30px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;”}
DirectInput is an API for input devices
including the mouse, keyboard, joystick, and other game controllers, as
well as for force-feedback (input/output) devices.
This topic provides a brief overview of
the capabilities of DirectInput and how to set it up in an application.
For a more comprehensive view of how DirectInput works, see Understanding
DirectInput. For a step-by-step guide to using the
DirectInput API, see Using
DirectInput.
The Power of DirectInput {.heading style=”padding-bottom:5px;widows:2;text-transform:none;text-indent:0px;margin:0px;font:18px ‘Segoe UI Light’, ‘Segoe UI’, ‘Lucida Grande’, Verdana, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;letter-spacing:normal;color:#db7100;word-spacing:0px;padding-top:5px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;”}
DirectInput enables an application to
retrieve data from input devices even when the application is in the
background. It also provides full support for any type of input device,
as well as for force feedback.
Through** action mapping**, applications can retrieve input data without
needing to know what kind of device is being used to generate it.
**The extended services and improved
performance of DirectInput make it a valuable tool for games,
simulations, and other real-time interactive applications running under
Windows.**
DirectInput does not provide any
advantages for applications that use the keyboard for text entry or the
mouse for navigation. For more information, see [Interaction with
Windows](http://msdn.microsoft.com/en-us/library/windows/desktop/ee418998(v=vs.85).aspx#Interaction_with_Windows).
Getting Started with DirectInput {.heading style=”padding-bottom:5px;widows:2;text-transform:none;text-indent:0px;margin:0px;font:18px ‘Segoe UI Light’, ‘Segoe UI’, ‘Lucida Grande’, Verdana, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;letter-spacing:normal;color:#db7100;word-spacing:0px;padding-top:5px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;”}
Understanding DirectInput {#TopicTitle style=”padding-bottom:35px;widows:2;text-transform:none;text-indent:0px;margin:0px;font:36px ‘Segoe UI Light’, ‘Segoe UI’, ‘Lucida Grande’, Verdana, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;letter-spacing:normal;color:#707070;word-spacing:0px;padding-top:30px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;”}
This topic covers the underlying structure
of Microsoft DirectInput and its relationship to the Microsoft Windows
message system.
For practical information about how to
implement the elements of DirectInput introduced here, see Using
DirectInput.
DirectInput Objects {.heading style=”padding-bottom:5px;widows:2;text-transform:none;text-indent:0px;margin:0px;font:18px ‘Segoe UI Light’, ‘Segoe UI’, ‘Lucida Grande’, Verdana, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;letter-spacing:normal;color:#db7100;word-spacing:0px;padding-top:5px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;”}
An input-only DirectInput implementation consists of the DirectInput
object, which supports [IDirectInput8
Interface](http://msdn.microsoft.com/en-us/library/windows/desktop/ee417799(v=vs.85).aspx),
a Component Object Model (COM)
interface, and a DirectInputDevice object for each input device that
provides data. Each DirectInputDevice object in turn has *device objects*, which are
individual controls or switches, such as keys, buttons, or axes. Device
objects are also called ***device object instances*****.**
**Each DirectInputDevice object represents one input device, such as a
mouse, keyboard, or joystick**. In the DirectInput API, the word ***joystick***** **means any type of input device other than a
mouse or keyboard. A piece of
hardware that is really a combination of different types of input
devices, such as a keyboard with a touchpad, can be represented by two
or more DirectInputDevice objects. A force-feedback device is represented by a
single joystick object that handles both input and output.
DirectInputDevice objects instantiate
the [**IDirectInputDevice8
Interface**](http://msdn.microsoft.com/en-us/library/windows/desktop/ee417816(v=vs.85).aspx)**.** The application ascertains the number and type
of device objects available by using the [**IDirectInputDevice8::EnumObjects**](http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.idirectinputdevice8.idirectinputdevice8.enumobjects(v=vs.85).aspx) method. Individual device objects are not
encapsulated as code objects, but are described in[**DIDEVICEOBJECTINSTANCE**](http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.reference.dideviceobjectinstance(v=vs.85).aspx) structures.
All DirectInput interfaces are available
in ANSI and Unicode versions. If "UNICODE" is defined during
compilation, the Unicode versions are used.
Interaction with Windows {.heading style=”padding-bottom:5px;widows:2;text-transform:none;text-indent:0px;margin:0px;font:18px ‘Segoe UI Light’, ‘Segoe UI’, ‘Lucida Grande’, Verdana, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;letter-spacing:normal;color:#db7100;word-spacing:0px;padding-top:5px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;”}
Because DirectInput works directly with
the device drivers, it either suppresses or ignores Windows mouse and keyboard messages.
It also ignores mouse and keyboard settings made by the user in Control
Panel. It does, however, use the
calibrations set for a joystick or other game controller.
DirectInput does not recognize keyboard
character repeat settings. When
using buffered data, DirectInput
interprets each press and release as a single event with no
repetition. When using immediate
data, DirectInput is concerned only with the present physical state of
the keys, not with keyboard events as interpreted by Windows.
DirectInput does not perform any character
conversion or translation. For example, the SHIFT key is treated like
any other key, not as a modifier of another keypress. Keys return the
same identifiers regardless of the user's system language
settings.
**Because DirectInput works directly with
the mouse driver, it bypasses the subsystem of Windows that interprets
mouse data for windowed applications. Applications that rely on the Windows cursor for
navigation should continue to use the standard Windows mouse messages
and Microsoft Win32 functions.**
When using the system mouse in exclusive
mode, DirectInput suppresses mouse messages, and therefore Windows is
unable to show the standard cursor.
DirectInput ignores Control Panel settings
such as acceleration and swapped buttons. However, DirectInput
recognizes settings in the driver itself. For example, if the user has a
three-button mouse and uses the driver-utility software to make the
middle button a double-click shortcut, DirectInput reports a click of
the middle button as two clicks of the primary button.
{#TopicTitle style=”padding-bottom:35px;widows:2;text-transform:none;text-indent:0px;margin:0px;font:36px ‘Segoe UI Light’, ‘Segoe UI’, ‘Lucida Grande’, Verdana, Arial, Helvetica, sans-serif;white-space:normal;orphans:2;letter-spacing:normal;color:#707070;word-spacing:0px;padding-top:30px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;”}
\