IDirectInputDevice::Acquire

The IDirectInputDevice::Acquire method obtains access to the input device.

HRESULT Acquire();
 

Parameters

None.

Return Values

If the method succeeds, the return value is DI_OK or S_FALSE.

If the method fails, the return value may be one of the following error values:

DIERR_INVALIDPARAM
DIERR_NOTINITIALIZED
DIERR_OTHERAPPHASPRIO

If the method returns S_FALSE, the device has already been acquired.

Remarks

Before a device can be acquired, a data format must be set by using the IDirectInputDevice::SetDataFormat method.

Devices must be acquired before calling the IDirectInputDevice::GetDeviceState or IDirectInputDevice::GetDeviceData methods for that device.

Device acquisition does not use a reference count. Therefore, if an application calls the IDirectInputDevice::Acquire method twice, then calls the IDirectInputDevice::Unacquire method once, the device is unacquired.

QuickInfo

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in dinput.h.
  Import Library: Use dinput.lib.