Microsoft DirectX 8.1 (C++) |
Creates a DirectInput® object and returns an IDirectInput8 or later interface.
HRESULT WINAPI DirectInput8Create( HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID* ppvOut, LPUNKNOWN punkOuter );
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.
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:
DIERR_BETADIRECTINPUTVERSION |
DIERR_INVALIDPARAM |
DIERR_OLDDIRECTINPUTVERSION |
DIERR_OUTOFMEMORY |
The DirectInput object created by this function is implemented in Dinput8d.dll. Versions of interfaces earlier than DirectX 8.0 cannot be obtained in this implementation. To use earlier versions, create the DirectInput object by using DirectInputCreate or DirectInputCreateEx, which are in Dinput.lib.
Calling the function with punkOuter = NULL is equivalent to creating the object through CoCreateInstance(&CLSID_DirectInput8, punkOuter, CLSCTX_INPROC_SERVER, &IID_IDirectInput8W, lplpDirectInput), then initializing it with IDirectInput8::Initialize.
Calling the function with punkOuter != NULL is equivalent to creating the object through CoCreateInstance(&CLSID_DirectInput8, punkOuter, CLSCTX_INPROC_SERVER, &IID_IUnknown, lplpDirectInput). The aggregated object must be initialized manually.
Windows NT/2000/XP: Requires Windows® 2000.
Windows 98/Me: Requires Windows 98 or later. Available as a redistributable for Windows 98.
Header: Declared in dinput.h.
Import Library: Use dinput8.lib.