Platform SDK: DirectX

IDirectInputDevice7::Acquire

The IDirectInputDevice7::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 can 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 IDirectInputDevice7::SetDataFormat method.

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

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

Requirements

  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.