Current version

v1.10.4 (stable)

Navigation

Main page
Archived news
Downloads
Documentation
   Capture
   Compiling
   Processing
   Crashes
Features
Filters
Plugin SDK
Knowledge base
Contact info
 
Other projects
   Altirra

Archives

Blog Archive

"DirectInput"

DirectInput is the name of the library in Microsoft DirectX at provides direct access on Windows to input devices such as the mouse, keyboard, and game controllers. Well, except that for some time, there's been nothing "direct" about DirectInput at all. Ever since Windows NT, pretty much all of the functionality in DirectInput can be replicated by going straight to the Win32 APIs and using functionality such as low-level keyboard hooks and raw input messages. Once you learn this, some of the restrictions of DirectInput become clear, such as why you can't reliably intercept input from a full-screen application using your own low-level keyboard hook.

I found this passage in the DirectInput docs for EnumDevices() today, which I found especially amusing:

On Microsoft Windows XP, DirectInput enumerates only one mouse and one keyboard device, referred to as the system mouse and the system keyboard. These devices represent the combined output of all mice and keyboards respectively on a system. For information about how to read from multiple mice or keyboards individually on Windows XP, see the WM_INPUT documentation.

Not only is DirectInput not direct, but it's even less direct than the regular Win32 API....

(See also: "DirectSound" and "Windows Vista.")

I guess it's a much more common scenario for people to want multiple keyboards or mice to act identically than for a program to read them separately, but it seems like DirectInput would be the natural place to expose such functionality. There's so much API churn in Windows lately that I think Microsoft bought a blender.

Comments

This blog was originally open for comments when this entry was first posted, but was later closed and then removed due to spam and after a migration away from the original blog software. Unfortunately, it would have been a lot of work to reformat the comments to republish them. The author thanks everyone who posted comments and added to the discussion.