/// <summary> /// Registers a callback with a device, that gets called whenever a "Soft Button" is pressed or released. /// </summary> /// <param name="device">A handle to a device.</param> /// <param name="callback">Callback delegate to be called whenever a "Soft Button" is pressed or released.</param> /// <remarks> /// Passing in a null to callback will disable the callback. /// </remarks> /// <exception cref="HResultException"></exception> public void RegisterSoftButtonCallback(IntPtr device, SoftButtonCallback callback) { HResult retVal = registerSoftButtonCallback(device, callback, new IntPtr()); if (retVal != HResultException.S_OK) { Dictionary <HResult, String> errorsMap = new Dictionary <HResult, String>() { { HResultException.E_HANDLE, "The device handle specified is invalid." } }; throw new HResultException(retVal, errorsMap); } }
internal static ReturnValues RegisterSoftButtonCallback(IntPtr hDevice, SoftButtonCallback pfnCallback) { return((ReturnValues)DirectOutput_RegisterSoftButtonCallback(hDevice, pfnCallback, IntPtr.Zero)); }
static extern IntPtr DirectOutput_RegisterSoftButtonCallback(IntPtr hDevice, [MarshalAs(UnmanagedType.FunctionPtr)] SoftButtonCallback pfnCallback, IntPtr pvParam);