HRESULT CreateDevice( REFGUID rguid, LPDIRECTINPUTDEVICE * lplpDirectInputDevice, LPUNKNOWN pUnkOuter )
Reference to the GUID for the desired input device (see Remarks). The GUID is retrieved through the
method, or it can be one of the predefined GUIDs listed below. For the following GUID values to be valid, your
application must define INITGUID before all other preprocessor directives at the beginning of the source file,
or link to Dxguid.lib.
- The default system keyboard.
- The default system mouse.
- Address of a variable to receive the IDirectInputDevice8 Interface interface pointer if successful.
- Address of the controlling object's IUnknown interface for COM aggregation, or NULL if the interface is not aggregated. Most calling applications pass NULL.
If the method succeeds, the return value is DI_OK. If the method fails, the return value can be one of the following: DIERR_DEVICENOTREG, DIERR_INVALIDPARAM, DIERR_NOINTERFACE, DIERR_NOTINITIALIZED, DIERR_OUTOFMEMORY.
Calling this method with pUnkOuter = NULL is equivalent to creating the object by CoCreateInstance (&CLSID_DirectInputDevice, NULL, CLSCTX_INPROC_SERVER, riid, lplpDirectInputDevice) and then initializing it with Initialize.
Calling this method with pUnkOuter != NULL is equivalent to creating the object by CoCreateInstance (&CLSID_DirectInputDevice, punkOuter, CLSCTX_INPROC_SERVER, &IID_IUnknown, lplpDirectInputDevice). The aggregated object must be initialized manually.