Platform SDK: DirectX |
The IDirectInput7::EnumDevice method enumerates devices that are either currently attached or could be attached to the computer.
HRESULT EnumDevices( DWORD dwDevType, LPDIENUMCALLBACK lpCallback, LPVOID pvRef, DWORD dwFlags );
If the method succeeds, the return value is DI_OK.
If the method fails, the return value can be one of the following error values:
DIERR_INVALIDPARAM |
DIERR_NOTINITIALIZED |
All installed devices can be enumerated, even if they are not present. For example, a flight stick might be installed on the system, but not currently plugged into the computer. Set the dwFlags parameter to indicate whether only attached or all installed devices should be enumerated. If the DIEDFL_ATTACHEDONLY flag is not present, all installed devices are enumerated.
A preferred device type can be passed as a dwDevType filter so that only the devices of that type are enumerated.
The lpCallback parameter specifies the address of a callback function of the type documented as DIEnumDevicesCallback. DirectInput calls this function for every device that is enumerated. In the callback, the device type and friendly name, and the product GUID and friendly name, are given for each device. If a single input device can function as more than one DirectInput device type, it is returned for each device type that it supports. For example, a keyboard with a built-in mouse is enumerated as a keyboard and as a mouse. The product GUID would be the same for each device, however.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in dinput.h.
Import Library: Use dinput.lib.