IDirectInput8::FindDevice Method

Retrieves the instance globally unique identifier (GUID) of a device that has been newly attached to the system. It is called in response to a Microsoft Win32 device management notification.


HRESULT FindDevice(
         REFGUID rguidClass,
         LPCTSTR ptszName,
         LPGUID pguidInstance


  • rguidClass
    Unique identifier of the device class for the device that the application is to locate. The application obtains the class GUID from the device arrival notification. For more information, see the documentation on the DBT_DEVICEARRIVAL event in the Microsoft Platform Software Development Kit (SDK).
  • ptszName
    Name of the device. The application obtains the name from the device arrival notification.
  • pguidInstance
    Address of a variable to receive the instance GUID for the device, if the device is found. This value can be passed to IDirectInput8::CreateDevice.

Return Value

If the method succeeds, the return value is DI_OK. If the method fails, the return value can be DIERR_DEVICENOTREG. Failure results if the GUID and name do not correspond to a device class that is registered with DirectInput. For example, they might refer to a storage device, rather than an input device.


Header: Declared in dinput.h.