The IDirectInputDevice::Acquire method obtains access to the input device.
HRESULT Acquire();
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: Use version 5.0 or later.
Windows: Use Windows 95 OSR2 or later. Available as a redistributable for Windows 95.
Windows CE: Unsupported.
Header: Declared in dinput.h.
Import Library: Use dinput.lib.