Microsoft DirectX 9.0

IDirectInput8::EnumDevicesBySemantics Method

Enumerates devices that most closely match the application-specified action map.


HRESULT EnumDevicesBySemantics(      

    LPCTSTR ptszUserName,     LPDIACTIONFORMAT lpdiActionFormat,     LPDIENUMDEVICESBYSEMANTICSCB lpCallback,     LPVOID pvRef,     DWORD dwFlags );


String identifying the current user, or NULL to specify the user logged onto the system. The user name is taken into account when enumerating devices. A device with user mappings is preferred to a device without any user mappings. By default, devices in use by other users are not enumerated for this user.
Address of a DIACTIONFORMAT structure that specifies the action map for which suitable devices are enumerated.
Address of a callback function to be called once for each device enumerated. See DIEnumDevicesBySemanticsCallback.
Application-defined 32-bit value to pass to the enumeration callback each time it is called.
Flag value that specifies the scope of the enumeration. This parameter can be one or more of the following values.
Only attached and installed devices are enumerated.
Only unowned, installed devices are enumerated.
Only devices that support force feedback are enumerated.
Only secondary (non-system) keyboard and mouse devices.
Only HID-compliant devices whose primary purpose is not as a gaming device. Devices such as USB speakers and multimedia buttons on some keyboards would fall within this value.
All installed devices for the user identified by ptszUserName, and all unowned devices, are enumerated.
DIEDBSFL_VALID is also defined in Dinput.h, but is not used by applications.

Return Value

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_INVALIDPARAMAn invalid parameter was passed to the returning function, or the object was not in a state that permitted the function to be called. This value is equal to the E_INVALIDARG standard Component Object Model (COM) return value.
DIERR_NOTINITIALIZEDThe object has not been initialized.


The keyboard and mouse are enumerated last.

Note  The order in which devices are enumerated by Microsoft?DirectInput?is not guaranteed.

See Also

IDirectInput8::EnumDevices, Action Mapping

© 2002 Microsoft Corporation. All rights reserved.