DirectInputCreate

This function is no longer supported as of Windows CE .NET version 4.2. This function creates a DirectInput object that supports the IDirectInput COM interface.

HRESULT WINAPI DirectInputCreate(
  HINSTANCE hinst,
  DWORD dwVersion,
  LPDIRECTINPUT* lplpDirectInput,
  LPUNKNOWN punkOuter
);

Parameters

  • hinst
    Instance handle to the application or dynamic-link library (DLL) that is creating the DirectInput object. DirectInput uses this value to determine whether the application or DLL has been certified and to establish any special behaviors that may be necessary for backward compatibility.

    It is an error for a DLL to pass the handle to the parent application. For example, an ActiveX control embedded in a Web page that uses DirectInput must pass its own instance handle, and not the handle to the Web browser. This ensures that DirectInput recognizes the control and can enable any special behaviors that might be necessary.

  • dwVersion
    Version number of DirectInput for which the application is designed. This value is normally DIRECTINPUT_VERSION. Passing the version number of a previous version causes DirectInput to emulate that version. For more information, see Designing for Previous Versions of DirectInput.

  • lplpDirectInput
    Address of a variable to receive a valid IDirectInput interface pointer if the call succeeds.

  • punkOuter
    Pointer to the address of the controlling object's IUnknown interface for COM aggregation, or NULL if the interface is not aggregated. Most callers pass NULL. If aggregation is requested, the object returned in *lplpDirectInput is a pointer to the IUnknown, rather than an IDirectInput interface, as required by COM aggregation.

Return Values

If the function succeeds, the return value is DI_OK. If the function fails, the return value can be one of the following error values.

Value Description
DIERR_BETADIRECTINPUTVERSION The application was written for an unsupported prerelease version of DirectInput.
DIERR_INVALIDPARAM An 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 COM return value.
DIERR_OLDDIRECTINPUTVERSION The application requires a newer version of DirectInput.
DIERR_OUTOFMEMORY The DirectInput subsystem could not allocate sufficient memory to complete the call. This value is equal to the E_OUTOFMEMORY standard COM return value.

Remarks

Calling the function with punkOuter = NULL is equivalent to creating the object through CoCreateInstance (&CLSID_DirectInput, punkOuter, CLSCTX_INPROC_SERVER, &IID_IDirectInput, lplpDirectInput), then initializing it with Initialize.

Calling the function with punkOuter != NULL is equivalent to creating the object through CoCreateInstance(&CLSID_DirectInput, punkOuter, CLSCTX_INPROC_SERVER, &IID_IUnknown, lplpDirectInput). The aggregated object must be initialized manually.

Microsoft Windows CE .NET supports only the Unicode version of this function.

To determine whether the platform supports this function, see Determining Supported COM APIs.

Requirements

OS Versions: Windows CE 2.12 through .NET 4.1.
Header: Dinput.h.

See Also

CoCreateInstance | IUnknown

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.