1# oh_input_manager.h 2 3<!--Kit: Input Kit--> 4<!--Subsystem: MultimodalInput--> 5<!--Owner: @zhaoxueyuan--> 6<!--Designer: @hanruofei--> 7<!--Tester: @Lyuxin--> 8<!--Adviser: @Brilliantry_Rui--> 9 10## Overview 11 12Provides functions such as event injection and status query. 13 14**File to include**: <multimodalinput/oh_input_manager.h> 15 16**Library**: libohinput.so 17 18**System capability**: SystemCapability.MultimodalInput.Input.Core 19 20**Since**: 12 21 22**Related module**: [input](capi-input.md) 23 24## Summary 25 26### Structs 27 28| Name| typedef Keyword| Description| 29| -- | -- | -- | 30| [Input_InterceptorEventCallback](capi-input-input-interceptoreventcallback.md) | Input_InterceptorEventCallback | Defines the structure of the interceptor for callback events, including mouse events, touch events, and axis events.| 31| [Input_DeviceListener](capi-input-input-devicelistener.md) | Input_DeviceListener | Defines a listener for device hot swap events.| 32| [Input_KeyState](capi-input-input-keystate.md) | Input_KeyState | Defines key information, which identifies a key pressing behavior. For example, the Ctrl key information contains the key value and key type.| 33| [Input_KeyEvent](capi-input-input-keyevent.md) | Input_KeyEvent | Defines the key event to be injected.| 34| [Input_MouseEvent](capi-input-input-mouseevent.md) | Input_MouseEvent | Defines the mouse event to be injected.| 35| [Input_TouchEvent](capi-input-input-touchevent.md) | Input_TouchEvent | Defines the touch event to be injected.| 36| [Input_AxisEvent](capi-input-input-axisevent.md) | Input_AxisEvent | Defines an axis event.| 37| [Input_Hotkey](capi-input-input-hotkey.md) | Input_Hotkey | Defines the shortcut key structure.| 38| [Input_DeviceInfo](capi-input-input-deviceinfo.md) | Input_DeviceInfo | Defines the input device information.| 39| [Input_InterceptorOptions](capi-input-input-interceptoroptions.md) | Input_InterceptorOptions | Defines event interception options.| 40 41### Enums 42 43| Name| typedef Keyword| Description| 44| -- | -- | -- | 45| [Input_KeyStateAction](#input_keystateaction) | Input_KeyStateAction | Provides the enum values of the key status.| 46| [Input_KeyEventAction](#input_keyeventaction) | Input_KeyEventAction | Provides the enum values of the key event type.| 47| [Input_MouseEventAction](#input_mouseeventaction) | Input_MouseEventAction | Provides the enum values of mouse actions.| 48| [InputEvent_MouseAxis](#inputevent_mouseaxis) | InputEvent_MouseAxis | Provides the enum values of mouse axis event types.| 49| [Input_MouseEventButton](#input_mouseeventbutton) | Input_MouseEventButton | Provides the enum values of mouse buttons.| 50| [Input_TouchEventAction](#input_toucheventaction) | Input_TouchEventAction | Provides the enum values of touch actions.| 51| [Input_InjectionStatus](#input_injectionstatus) | Input_InjectionStatus | Provides the enum values of injection permission states.| 52| [InputEvent_SourceType](#inputevent_sourcetype) | InputEvent_SourceType | Provides the enum values of event source types.| 53| [Input_KeyboardType](#input_keyboardtype) | Input_KeyboardType | Provides the enum values of keyboard types of the input device.| 54| [Input_Result](#input_result) | Input_Result | Provides the enum values of error codes.| 55 56### Functions 57 58| Name| typedef Keyword| Description| 59| -- | -- | -- | 60| [typedef void (\*Input_HotkeyCallback)(Input_Hotkey* hotkey)](#input_hotkeycallback) | Input_HotkeyCallback | Defines the callback used to return shortcut key events.| 61| [typedef void (\*Input_KeyEventCallback)(const Input_KeyEvent* keyEvent)](#input_keyeventcallback) | Input_KeyEventCallback | Defines a lifecycle callback for **keyEvent**. If the callback is triggered, **keyEvent** will be destroyed.| 62| [typedef void (\*Input_MouseEventCallback)(const Input_MouseEvent* mouseEvent)](#input_mouseeventcallback) | Input_MouseEventCallback | Defines a lifecycle callback for **mouseEvent**. If the callback is triggered, **mouseEvent** will be destroyed.| 63| [typedef void (\*Input_TouchEventCallback)(const Input_TouchEvent* touchEvent)](#input_toucheventcallback) | Input_TouchEventCallback | Defines a lifecycle callback for **touchEvent**. If the callback is triggered, **touchEvent** will be destroyed.| 64| [typedef void (\*Input_AxisEventCallback)(const Input_AxisEvent* axisEvent)](#input_axiseventcallback) | Input_AxisEventCallback | Defines a lifecycle callback for **axisEvent**. If the callback is triggered, **axisEvent** will be destroyed.| 65| [typedef void (\*Input_DeviceAddedCallback)(int32_t deviceId)](#input_deviceaddedcallback) | Input_DeviceAddedCallback | Defines a callback used to receive device insertion events.| 66| [typedef void (\*Input_DeviceRemovedCallback)(int32_t deviceId)](#input_deviceremovedcallback) | Input_DeviceRemovedCallback | Defines a callback used to receive device removal events.| 67| [typedef void (\*Input_InjectAuthorizeCallback)(Input_InjectionStatus authorizedStatus)](#input_injectauthorizecallback) | Input_InjectAuthorizeCallback | Defines a callback used to receive the injection permission authorization status.| 68| [Input_Result OH_Input_GetKeyState(struct Input_KeyState* keyState)](#oh_input_getkeystate) | - | Queries a key status enum object.| 69| [struct Input_KeyState* OH_Input_CreateKeyState()](#oh_input_createkeystate) | - | Creates a key status enum object.| 70| [void OH_Input_DestroyKeyState(struct Input_KeyState** keyState)](#oh_input_destroykeystate) | - | Destroys a key status enum object.| 71| [void OH_Input_SetKeyCode(struct Input_KeyState* keyState, int32_t keyCode)](#oh_input_setkeycode) | - | Sets the key value of a key status enum object.| 72| [int32_t OH_Input_GetKeyCode(const struct Input_KeyState* keyState)](#oh_input_getkeycode) | - | Obtains the key value of a key status enum object.| 73| [void OH_Input_SetKeyPressed(struct Input_KeyState* keyState, int32_t keyAction)](#oh_input_setkeypressed) | - | Sets whether the key specific to a key status enum object is pressed.| 74| [int32_t OH_Input_GetKeyPressed(const struct Input_KeyState* keyState)](#oh_input_getkeypressed) | - | Checks whether the key specific to a key status enum object is pressed.| 75| [void OH_Input_SetKeySwitch(struct Input_KeyState* keyState, int32_t keySwitch)](#oh_input_setkeyswitch) | - | Sets the key switch of the key status enum object.| 76| [int32_t OH_Input_GetKeySwitch(const struct Input_KeyState* keyState)](#oh_input_getkeyswitch) | - | Obtains the key switch of the key status enum object.| 77| [int32_t OH_Input_InjectKeyEvent(const struct Input_KeyEvent* keyEvent)](#oh_input_injectkeyevent) | - | Injects a key event.| 78| [struct Input_KeyEvent* OH_Input_CreateKeyEvent()](#oh_input_createkeyevent) | - | Creates a key event object.| 79| [void OH_Input_DestroyKeyEvent(struct Input_KeyEvent** keyEvent)](#oh_input_destroykeyevent) | - | Destroys a key event object.| 80| [void OH_Input_SetKeyEventAction(struct Input_KeyEvent* keyEvent, int32_t action)](#oh_input_setkeyeventaction) | - | Sets the key event type.| 81| [int32_t OH_Input_GetKeyEventAction(const struct Input_KeyEvent* keyEvent)](#oh_input_getkeyeventaction) | - | Obtains the key event type.| 82| [void OH_Input_SetKeyEventKeyCode(struct Input_KeyEvent* keyEvent, int32_t keyCode)](#oh_input_setkeyeventkeycode) | - | Sets the key code value for a key event.| 83| [int32_t OH_Input_GetKeyEventKeyCode(const struct Input_KeyEvent* keyEvent)](#oh_input_getkeyeventkeycode) | - | Obtains the key code value of a key event.| 84| [void OH_Input_SetKeyEventActionTime(struct Input_KeyEvent* keyEvent, int64_t actionTime)](#oh_input_setkeyeventactiontime) | - | Sets the time when a key event occurs.| 85| [int64_t OH_Input_GetKeyEventActionTime(const struct Input_KeyEvent* keyEvent)](#oh_input_getkeyeventactiontime) | - | Obtains the time when a key event occurs.| 86| [void OH_Input_SetKeyEventWindowId(struct Input_KeyEvent* keyEvent, int32_t windowId)](#oh_input_setkeyeventwindowid) | - | Sets the window ID of a key event.| 87| [int32_t OH_Input_GetKeyEventWindowId(const struct Input_KeyEvent* keyEvent)](#oh_input_getkeyeventwindowid) | - | Obtains the window ID of a key event.| 88| [void OH_Input_SetKeyEventDisplayId(struct Input_KeyEvent* keyEvent, int32_t displayId)](#oh_input_setkeyeventdisplayid) | - | Sets the screen ID of a key event.| 89| [int32_t OH_Input_GetKeyEventDisplayId(const struct Input_KeyEvent* keyEvent)](#oh_input_getkeyeventdisplayid) | - | Obtains the screen ID of a key event.| 90| [struct Input_MouseEvent* OH_Input_CreateMouseEvent()](#oh_input_createmouseevent) | - | Creates a mouse event object.| 91| [void OH_Input_DestroyMouseEvent(struct Input_MouseEvent** mouseEvent)](#oh_input_destroymouseevent) | - | Destroys a mouse event object.| 92| [void OH_Input_SetMouseEventAction(struct Input_MouseEvent* mouseEvent, int32_t action)](#oh_input_setmouseeventaction) | - | Sets the action for a mouse event.| 93| [int32_t OH_Input_GetMouseEventAction(const struct Input_MouseEvent* mouseEvent)](#oh_input_getmouseeventaction) | - | Obtains the action of a mouse event.| 94| [void OH_Input_SetMouseEventDisplayX(struct Input_MouseEvent* mouseEvent, int32_t displayX)](#oh_input_setmouseeventdisplayx) | - | Sets the X coordinate of the mouse event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 95| [int32_t OH_Input_GetMouseEventDisplayX(const struct Input_MouseEvent* mouseEvent)](#oh_input_getmouseeventdisplayx) | - | Obtains the X coordinate of the mouse event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 96| [void OH_Input_SetMouseEventDisplayY(struct Input_MouseEvent* mouseEvent, int32_t displayY)](#oh_input_setmouseeventdisplayy) | - | Sets the Y coordinate of the mouse event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 97| [int32_t OH_Input_GetMouseEventDisplayY(const struct Input_MouseEvent* mouseEvent)](#oh_input_getmouseeventdisplayy) | - | Obtains the Y coordinate of the mouse event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 98| [void OH_Input_SetMouseEventButton(struct Input_MouseEvent* mouseEvent, int32_t button)](#oh_input_setmouseeventbutton) | - | Sets the button for a mouse event.| 99| [int32_t OH_Input_GetMouseEventButton(const struct Input_MouseEvent* mouseEvent)](#oh_input_getmouseeventbutton) | - | Obtains the button of a mouse event.| 100| [void OH_Input_SetMouseEventAxisType(struct Input_MouseEvent* mouseEvent, int32_t axisType)](#oh_input_setmouseeventaxistype) | - | Sets the axis type for a mouse event.| 101| [int32_t OH_Input_GetMouseEventAxisType(const struct Input_MouseEvent* mouseEvent)](#oh_input_getmouseeventaxistype) | - | Obtains the axis type of a mouse event.| 102| [void OH_Input_SetMouseEventAxisValue(struct Input_MouseEvent* mouseEvent, float axisValue)](#oh_input_setmouseeventaxisvalue) | - | Sets the axis value for a mouse axis event.| 103| [float OH_Input_GetMouseEventAxisValue(const struct Input_MouseEvent* mouseEvent)](#oh_input_getmouseeventaxisvalue) | - | Obtains the axis value of a mouse axis event.| 104| [void OH_Input_SetMouseEventActionTime(struct Input_MouseEvent* mouseEvent, int64_t actionTime)](#oh_input_setmouseeventactiontime) | - | Sets the time when a mouse event occurs.| 105| [int64_t OH_Input_GetMouseEventActionTime(const struct Input_MouseEvent* mouseEvent)](#oh_input_getmouseeventactiontime) | - | Obtains the time when a mouse event occurs.| 106| [void OH_Input_SetMouseEventWindowId(struct Input_MouseEvent* mouseEvent, int32_t windowId)](#oh_input_setmouseeventwindowid) | - | Sets the window ID of a mouse event.| 107| [int32_t OH_Input_GetMouseEventWindowId(const struct Input_MouseEvent* mouseEvent)](#oh_input_getmouseeventwindowid) | - | Obtains the window ID of a mouse event.| 108| [void OH_Input_SetMouseEventDisplayId(struct Input_MouseEvent* mouseEvent, int32_t displayId)](#oh_input_setmouseeventdisplayid) | - | Sets the screen ID of a mouse event.| 109| [struct Input_TouchEvent* OH_Input_CreateTouchEvent()](#oh_input_createtouchevent) | - | Creates a touch event object.| 110| [void OH_Input_DestroyTouchEvent(struct Input_TouchEvent** touchEvent)](#oh_input_destroytouchevent) | - | Destroys a touch event object.| 111| [void OH_Input_SetTouchEventAction(struct Input_TouchEvent* touchEvent, int32_t action)](#oh_input_settoucheventaction) | - | Sets the action for a touch event.| 112| [int32_t OH_Input_GetTouchEventAction(const struct Input_TouchEvent* touchEvent)](#oh_input_gettoucheventaction) | - | Obtains the action of a touch event.| 113| [void OH_Input_SetTouchEventFingerId(struct Input_TouchEvent* touchEvent, int32_t id)](#oh_input_settoucheventfingerid) | - | Sets the finger ID for a touch event.| 114| [int32_t OH_Input_GetTouchEventFingerId(const struct Input_TouchEvent* touchEvent)](#oh_input_gettoucheventfingerid) | - | Obtains the finger ID of a touch event.| 115| [void OH_Input_SetTouchEventDisplayX(struct Input_TouchEvent* touchEvent, int32_t displayX)](#oh_input_settoucheventdisplayx) | - | Sets the X coordinate of the touch event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 116| [int32_t OH_Input_GetTouchEventDisplayX(const struct Input_TouchEvent* touchEvent)](#oh_input_gettoucheventdisplayx) | - | Obtains the X coordinate of the touch event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 117| [void OH_Input_SetTouchEventDisplayY(struct Input_TouchEvent* touchEvent, int32_t displayY)](#oh_input_settoucheventdisplayy) | - | Sets the Y coordinate of the touch event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 118| [int32_t OH_Input_GetTouchEventDisplayY(const struct Input_TouchEvent* touchEvent)](#oh_input_gettoucheventdisplayy) | - | Obtains the Y coordinate of the touch event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 119| [void OH_Input_SetTouchEventActionTime(struct Input_TouchEvent* touchEvent, int64_t actionTime)](#oh_input_settoucheventactiontime) | - | Sets the time when a touch event occurs.| 120| [int64_t OH_Input_GetTouchEventActionTime(const struct Input_TouchEvent* touchEvent)](#oh_input_gettoucheventactiontime) | - | Obtains the time when a touch event occurs.| 121| [void OH_Input_SetTouchEventWindowId(struct Input_TouchEvent* touchEvent, int32_t windowId)](#oh_input_settoucheventwindowid) | - | Sets the window ID of a touch event.| 122| [int32_t OH_Input_GetTouchEventWindowId(const struct Input_TouchEvent* touchEvent)](#oh_input_gettoucheventwindowid) | - | Obtains the window ID of a touch event.| 123| [void OH_Input_SetTouchEventDisplayId(struct Input_TouchEvent* touchEvent, int32_t displayId)](#oh_input_settoucheventdisplayid) | - | Sets the screen ID of a touch event.| 124| [int32_t OH_Input_GetTouchEventDisplayId(const struct Input_TouchEvent* touchEvent)](#oh_input_gettoucheventdisplayid) | - | Obtains the screen ID of a touch event.| 125| [void OH_Input_CancelInjection()](#oh_input_cancelinjection) | - | Stops event injection and revokes authorization.| 126| [Input_Result OH_Input_RequestInjection(Input_InjectAuthorizeCallback callback)](#oh_input_requestinjection) | - | Requests the permission for [OH_Input_InjectKeyEvent](capi-oh-input-manager-h.md#oh_input_injectkeyevent), [OH_Input_InjectTouchEvent](capi-oh-input-manager-h.md#oh_input_injecttouchevent), and [OH_Input_InjectMouseEvent](capi-oh-input-manager-h.md#oh_input_injectmouseevent). This API takes effect only on PCs/2-in-1 devices.| 127| [Input_Result OH_Input_QueryAuthorizedStatus(Input_InjectionStatus* status)](#oh_input_queryauthorizedstatus) | - | Queries the injection permission authorization status of the current application.| 128| [Input_AxisEvent* OH_Input_CreateAxisEvent(void)](#oh_input_createaxisevent) | - | Creates an axis event object.| 129| [Input_Result OH_Input_DestroyAxisEvent(Input_AxisEvent** axisEvent)](#oh_input_destroyaxisevent) | - | Destroys an axis event object.| 130| [Input_Result OH_Input_SetAxisEventAction(Input_AxisEvent* axisEvent, InputEvent_AxisAction action)](#oh_input_setaxiseventaction) | - | Sets the action for an axis event.| 131| [Input_Result OH_Input_GetAxisEventAction(const Input_AxisEvent* axisEvent, InputEvent_AxisAction *action)](#oh_input_getaxiseventaction) | - | Obtains the action of an axis event.| 132| [Input_Result OH_Input_SetAxisEventDisplayX(Input_AxisEvent* axisEvent, float displayX)](#oh_input_setaxiseventdisplayx) | - | Sets the X coordinate of the axis event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 133| [Input_Result OH_Input_GetAxisEventDisplayX(const Input_AxisEvent* axisEvent, float* displayX)](#oh_input_getaxiseventdisplayx) | - | Obtains the X coordinate of the axis event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 134| [Input_Result OH_Input_SetAxisEventDisplayY(Input_AxisEvent* axisEvent, float displayY)](#oh_input_setaxiseventdisplayy) | - | Sets the Y coordinate of the axis event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 135| [Input_Result OH_Input_GetAxisEventDisplayY(const Input_AxisEvent* axisEvent, float* displayY)](#oh_input_getaxiseventdisplayy) | - | Obtains the Y coordinate of the axis event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 136| [Input_Result OH_Input_SetAxisEventAxisValue(Input_AxisEvent* axisEvent,InputEvent_AxisType axisType, double axisValue)](#oh_input_setaxiseventaxisvalue) | - | Sets the axis value of the axis type specified by the axis event.| 137| [Input_Result OH_Input_GetAxisEventAxisValue(const Input_AxisEvent* axisEvent,InputEvent_AxisType axisType, double* axisValue)](#oh_input_getaxiseventaxisvalue) | - | Obtains the axis value for the specified axis type of the axis event.| 138| [Input_Result OH_Input_SetAxisEventActionTime(Input_AxisEvent* axisEvent, int64_t actionTime)](#oh_input_setaxiseventactiontime) | - | Sets the time when an axis event occurs.| 139| [Input_Result OH_Input_GetAxisEventActionTime(const Input_AxisEvent* axisEvent, int64_t* actionTime)](#oh_input_getaxiseventactiontime) | - | Obtains the time when an axis event occurs.| 140| [Input_Result OH_Input_SetAxisEventType(Input_AxisEvent* axisEvent, InputEvent_AxisEventType axisEventType)](#oh_input_setaxiseventtype) | - | Sets the axis event type.| 141| [Input_Result OH_Input_GetAxisEventType(const Input_AxisEvent* axisEvent, InputEvent_AxisEventType* axisEventType)](#oh_input_getaxiseventtype) | - | Obtains the axis event type.| 142| [Input_Result OH_Input_SetAxisEventSourceType(Input_AxisEvent* axisEvent, InputEvent_SourceType sourceType)](#oh_input_setaxiseventsourcetype) | - | Sets the axis event source type.| 143| [Input_Result OH_Input_GetAxisEventSourceType(const Input_AxisEvent* axisEvent, InputEvent_SourceType* sourceType)](#oh_input_getaxiseventsourcetype) | - | Obtains the axis event source type.| 144| [Input_Result OH_Input_SetAxisEventWindowId(Input_AxisEvent* axisEvent, int32_t windowId)](#oh_input_setaxiseventwindowid) | - | Sets the window ID of an axis event.| 145| [Input_Result OH_Input_GetAxisEventWindowId(const Input_AxisEvent* axisEvent, int32_t* windowId)](#oh_input_getaxiseventwindowid) | - | Obtains the window ID of an axis event.| 146| [Input_Result OH_Input_SetAxisEventDisplayId(Input_AxisEvent* axisEvent, int32_t displayId)](#oh_input_setaxiseventdisplayid) | - | Sets the screen ID of an axis event.| 147| [Input_Result OH_Input_GetAxisEventDisplayId(const Input_AxisEvent* axisEvent, int32_t* displayId)](#oh_input_getaxiseventdisplayid) | - | Obtains the screen ID of an axis event.| 148| [Input_Result OH_Input_AddKeyEventMonitor(Input_KeyEventCallback callback)](#oh_input_addkeyeventmonitor) | - | Adds a listener for key events.| 149| [Input_Result OH_Input_AddMouseEventMonitor(Input_MouseEventCallback callback)](#oh_input_addmouseeventmonitor) | - | Adds a listener for mouse events, including mouse click and movement events, but not scroll wheel events. Scroll wheel events are axis events.| 150| [Input_Result OH_Input_AddTouchEventMonitor(Input_TouchEventCallback callback)](#oh_input_addtoucheventmonitor) | - | Adds a listener for touch events.| 151| [Input_Result OH_Input_AddAxisEventMonitorForAll(Input_AxisEventCallback callback)](#oh_input_addaxiseventmonitorforall) | - | Adds a listener for all types of axis events, which are defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype).| 152| [Input_Result OH_Input_AddAxisEventMonitor(InputEvent_AxisEventType axisEventType, Input_AxisEventCallback callback)](#oh_input_addaxiseventmonitor) | - | Adds a listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype).| 153| [Input_Result OH_Input_RemoveKeyEventMonitor(Input_KeyEventCallback callback)](#oh_input_removekeyeventmonitor) | - | Removes the listener for key events.| 154| [Input_Result OH_Input_RemoveMouseEventMonitor(Input_MouseEventCallback callback)](#oh_input_removemouseeventmonitor) | - | Removes the listener for mouse events.| 155| [Input_Result OH_Input_RemoveTouchEventMonitor(Input_TouchEventCallback callback)](#oh_input_removetoucheventmonitor) | - | Removes the listener for touch events.| 156| [Input_Result OH_Input_RemoveAxisEventMonitorForAll(Input_AxisEventCallback callback)](#oh_input_removeaxiseventmonitorforall) | - | Removes the listener for all types of axis events.| 157| [Input_Result OH_Input_RemoveAxisEventMonitor(InputEvent_AxisEventType axisEventType, Input_AxisEventCallback callback)](#oh_input_removeaxiseventmonitor) | - | Removes the listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype).| 158| [Input_Result OH_Input_AddKeyEventInterceptor(Input_KeyEventCallback callback, Input_InterceptorOptions *option)](#oh_input_addkeyeventinterceptor) | - | Adds an interceptor for key events. If multiple interceptors are added, only the first one takes effect. Key events are intercepted only when the application gains focus.| 159| [Input_Result OH_Input_AddInputEventInterceptor(Input_InterceptorEventCallback *callback,Input_InterceptorOptions *option)](#oh_input_addinputeventinterceptor) | - | Adds an interceptor for input events, including mouse, touch, and axis events. If multiple interceptors are added, only the first one takes effect. Key events are intercepted only when the application window is hit.| 160| [Input_Result OH_Input_RemoveKeyEventInterceptor(void)](#oh_input_removekeyeventinterceptor) | - | Removes the interceptor for key events.| 161| [Input_Result OH_Input_RemoveInputEventInterceptor(void)](#oh_input_removeinputeventinterceptor) | - | Removes the interceptor for input events, including mouse, touch, and axis events.| 162| [Input_Result OH_Input_GetIntervalSinceLastInput(int64_t *timeInterval)](#oh_input_getintervalsincelastinput) | - | Obtains the interval since the last system input event.| 163| [Input_Hotkey *OH_Input_CreateHotkey(void)](#oh_input_createhotkey) | - | Creates a shortcut key object.| 164| [void OH_Input_DestroyHotkey(Input_Hotkey **hotkey)](#oh_input_destroyhotkey) | - | Destroys a shortcut key object.| 165| [void OH_Input_SetPreKeys(Input_Hotkey *hotkey, int32_t *preKeys, int32_t size)](#oh_input_setprekeys) | - | Sets the modifier key.| 166| [Input_Result OH_Input_GetPreKeys(const Input_Hotkey *hotkey, int32_t **preKeys, int32_t *preKeyCount)](#oh_input_getprekeys) | - | Obtains the modifier key.| 167| [void OH_Input_SetFinalKey(Input_Hotkey* hotkey, int32_t finalKey)](#oh_input_setfinalkey) | - | Sets the modified key.| 168| [Input_Result OH_Input_GetFinalKey(const Input_Hotkey* hotkey, int32_t *finalKeyCode)](#oh_input_getfinalkey) | - | Obtains the modified key.| 169| [Input_Hotkey **OH_Input_CreateAllSystemHotkeys(int32_t count)](#oh_input_createallsystemhotkeys) | - | Creates an [Input_Hotkey](capi-input-input-hotkey.md) array.| 170| [void OH_Input_DestroyAllSystemHotkeys(Input_Hotkey **hotkeys, int32_t count)](#oh_input_destroyallsystemhotkeys) | - | Destroys an [Input_Hotkey](capi-input-input-hotkey.md) array and reclaims the memory.| 171| [Input_Result OH_Input_GetAllSystemHotkeys(Input_Hotkey **hotkey, int32_t *count)](#oh_input_getallsystemhotkeys) | - | Obtains all configured shortcut keys.| 172| [void OH_Input_SetRepeat(Input_Hotkey* hotkey, bool isRepeat)](#oh_input_setrepeat) | - | Specifies whether to report repeated key events.| 173| [Input_Result OH_Input_GetRepeat(const Input_Hotkey* hotkey, bool *isRepeat)](#oh_input_getrepeat) | - | Checks whether to report repeated key events.| 174| [Input_Result OH_Input_AddHotkeyMonitor(const Input_Hotkey* hotkey, Input_HotkeyCallback callback)](#oh_input_addhotkeymonitor) | - | Subscribes to shortcut key events. This API is not applicable to wearables and lite wearables.| 175| [Input_Result OH_Input_RemoveHotkeyMonitor(const Input_Hotkey* hotkey, Input_HotkeyCallback callback)](#oh_input_removehotkeymonitor) | - | Unsubscribes from shortcut key events.| 176| [Input_Result OH_Input_RegisterDeviceListener(Input_DeviceListener* listener)](#oh_input_registerdevicelistener) | - | Registers a listener for device hot swap events.| 177| [Input_Result OH_Input_UnregisterDeviceListener(Input_DeviceListener* listener)](#oh_input_unregisterdevicelistener) | - | Unregisters the listener for device hot swap events.| 178| [Input_Result OH_Input_UnregisterDeviceListeners()](#oh_input_unregisterdevicelisteners) | - | Unregisters the listener for all device hot swap events.| 179| [Input_Result OH_Input_GetDeviceIds(int32_t *deviceIds, int32_t inSize, int32_t *outSize)](#oh_input_getdeviceids) | - | Obtains the IDs of all input devices.| 180| [Input_Result OH_Input_GetDevice(int32_t deviceId, Input_DeviceInfo **deviceInfo)](#oh_input_getdevice) | - | Obtains information about the input device.| 181| [Input_DeviceInfo* OH_Input_CreateDeviceInfo(void)](#oh_input_createdeviceinfo) | - | Creates a **deviceInfo** object.| 182| [void OH_Input_DestroyDeviceInfo(Input_DeviceInfo **deviceInfo)](#oh_input_destroydeviceinfo) | - | Destroys a **deviceInfo** object.| 183| [Input_Result OH_Input_GetKeyboardType(int32_t deviceId, int32_t *keyboardType)](#oh_input_getkeyboardtype) | - | Obtains the keyboard type of the input device.| 184| [Input_Result OH_Input_GetDeviceId(Input_DeviceInfo *deviceInfo, int32_t *id)](#oh_input_getdeviceid) | - | Obtains the ID of an input device.| 185| [Input_Result OH_Input_GetDeviceName(Input_DeviceInfo *deviceInfo, char **name)](#oh_input_getdevicename) | - | Obtains the name of an input device.| 186| [Input_Result OH_Input_GetCapabilities(Input_DeviceInfo *deviceInfo, int32_t *capabilities)](#oh_input_getcapabilities) | - | Obtains the capabilities of an input device, for example, a touchscreen, touchpad, or keyboard.| 187| [Input_Result OH_Input_GetDeviceVersion(Input_DeviceInfo *deviceInfo, int32_t *version)](#oh_input_getdeviceversion) | - | Obtains the version information of an input device.| 188| [Input_Result OH_Input_GetDeviceProduct(Input_DeviceInfo *deviceInfo, int32_t *product)](#oh_input_getdeviceproduct) | - | Obtains the product information of an input device.| 189| [Input_Result OH_Input_GetDeviceVendor(Input_DeviceInfo *deviceInfo, int32_t *vendor)](#oh_input_getdevicevendor) | - | Obtains the vendor information of an input device.| 190| [Input_Result OH_Input_GetDeviceAddress(Input_DeviceInfo *deviceInfo, char **address)](#oh_input_getdeviceaddress) | - | Obtains the physical address of an input device.| 191| [Input_Result OH_Input_GetFunctionKeyState(int32_t keyCode, int32_t *state)](#oh_input_getfunctionkeystate) | - | Obtains the function key status.| 192| [int32_t OH_Input_InjectTouchEvent(const struct Input_TouchEvent* touchEvent)](#oh_input_injecttouchevent) | - | Injects a touch event by using coordinates in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 193| [int32_t OH_Input_InjectMouseEvent(const struct Input_MouseEvent* mouseEvent)](#oh_input_injectmouseevent) | - | Injects a mouse event by using coordinates in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 194| [int32_t OH_Input_GetMouseEventDisplayId(const struct Input_MouseEvent* mouseEvent)](#oh_input_getmouseeventdisplayid) | - | Obtains the screen ID of a mouse event.| 195| [Input_Result OH_Input_QueryMaxTouchPoints(int32_t *count)](#oh_input_querymaxtouchpoints) | - | Queries the maximum number of touch points supported by the device.| 196| [int32_t OH_Input_InjectMouseEventGlobal(const struct Input_MouseEvent* mouseEvent)](#oh_input_injectmouseeventglobal) | - | Injects a mouse event by using coordinates in the global coordinate system with the upper-left corner of the primary screen as the origin.| 197| [void OH_Input_SetMouseEventGlobalX(struct Input_MouseEvent* mouseEvent, int32_t globalX)](#oh_input_setmouseeventglobalx) | - | Sets the X coordinate of the mouse event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 198| [int32_t OH_Input_GetMouseEventGlobalX(const struct Input_MouseEvent* mouseEvent)](#oh_input_getmouseeventglobalx) | - | Obtains the X coordinate of the mouse event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 199| [void OH_Input_SetMouseEventGlobalY(struct Input_MouseEvent* mouseEvent, int32_t globalY)](#oh_input_setmouseeventglobaly) | - | Sets the Y coordinate of the mouse event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 200| [int32_t OH_Input_GetMouseEventGlobalY(const struct Input_MouseEvent* mouseEvent)](#oh_input_getmouseeventglobaly) | - | Obtains the Y coordinate of the mouse event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 201| [int32_t OH_Input_InjectTouchEventGlobal(const struct Input_TouchEvent* touchEvent)](#oh_input_injecttoucheventglobal) | - | Injects a touch event by using coordinates in the global coordinate system with the upper-left corner of the primary screen as the origin.| 202| [void OH_Input_SetTouchEventGlobalX(struct Input_TouchEvent* touchEvent, int32_t globalX)](#oh_input_settoucheventglobalx) | - | Sets the X coordinate of the touch event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 203| [int32_t OH_Input_GetTouchEventGlobalX(const struct Input_TouchEvent* touchEvent)](#oh_input_gettoucheventglobalx) | - | Obtains the X coordinate of the touch event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 204| [void OH_Input_SetTouchEventGlobalY(struct Input_TouchEvent* touchEvent, int32_t globalY)](#oh_input_settoucheventglobaly) | - | Sets the Y coordinate of the touch event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 205| [int32_t OH_Input_GetTouchEventGlobalY(const struct Input_TouchEvent* touchEvent)](#oh_input_gettoucheventglobaly) | - | Obtains the X coordinate of the touch event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 206| [Input_Result OH_Input_SetAxisEventGlobalX(struct Input_AxisEvent* axisEvent, int32_t globalX)](#oh_input_setaxiseventglobalx) | - | Sets the X coordinate of the axis event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 207| [Input_Result OH_Input_GetAxisEventGlobalX(const Input_AxisEvent* axisEvent, int32_t* globalX)](#oh_input_getaxiseventglobalx) | - | Obtains the X coordinate of the axis event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 208| [Input_Result OH_Input_SetAxisEventGlobalY(struct Input_AxisEvent* axisEvent, int32_t globalY)](#oh_input_setaxiseventglobaly) | - | Sets the Y coordinate of the axis event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 209| [Input_Result OH_Input_GetAxisEventGlobalY(const Input_AxisEvent* axisEvent, int32_t* globalY)](#oh_input_getaxiseventglobaly) | - | Obtains the Y coordinate of the axis event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 210| [Input_Result OH_Input_GetPointerLocation(int32_t *displayId, double *displayX, double *displayY)](#oh_input_getpointerlocation) | - | Obtains the coordinates of the mouse pointer on the screen.| 211 212## Enum Description 213 214### Input_KeyStateAction 215 216``` 217enum Input_KeyStateAction 218``` 219 220**Description** 221 222Provides the enum values of the key status. 223 224**Since**: 12 225 226| Enum| Description| 227| -- | -- | 228| KEY_DEFAULT = -1 | Default state.| 229| KEY_PRESSED = 0 | Key press.| 230| KEY_RELEASED = 1 | Key release.| 231| KEY_SWITCH_ON = 2 | Key switch enabled.| 232| KEY_SWITCH_OFF = 3 | Key switch disabled.| 233 234### Input_KeyEventAction 235 236``` 237enum Input_KeyEventAction 238``` 239 240**Description** 241 242Provides the enum values of the key event type. 243 244**Since**: 12 245 246| Enum| Description| 247| -- | -- | 248| KEY_ACTION_CANCEL = 0 | Button action canceled.| 249| KEY_ACTION_DOWN = 1 | Key press.| 250| KEY_ACTION_UP = 2 | Key release.| 251 252### Input_MouseEventAction 253 254``` 255enum Input_MouseEventAction 256``` 257 258**Description** 259 260Provides the enum values of mouse actions. 261 262**Since**: 12 263 264| Enum| Description| 265| -- | -- | 266| MOUSE_ACTION_CANCEL = 0 | Cancellation of the mouse action.| 267| MOUSE_ACTION_MOVE = 1 | Moving of the mouse pointer.| 268| MOUSE_ACTION_BUTTON_DOWN = 2 | Pressing of the mouse button.| 269| MOUSE_ACTION_BUTTON_UP = 3 | Release of the mouse button.| 270| MOUSE_ACTION_AXIS_BEGIN = 4 | Beginning of the mouse axis event.| 271| MOUSE_ACTION_AXIS_UPDATE = 5 | Updating of the mouse axis event.| 272| MOUSE_ACTION_AXIS_END = 6 | End of the mouse axis event.| 273 274### InputEvent_MouseAxis 275 276``` 277enum InputEvent_MouseAxis 278``` 279 280**Description** 281 282Provides the enum values of mouse axis event types. 283 284**Since**: 12 285 286| Enum| Description| 287| -- | -- | 288| MOUSE_AXIS_SCROLL_VERTICAL = 0 | Vertical scroll axis.| 289| MOUSE_AXIS_SCROLL_HORIZONTAL = 1 | Horizontal scroll axis.| 290 291### Input_MouseEventButton 292 293``` 294enum Input_MouseEventButton 295``` 296 297**Description** 298 299Provides the enum values of mouse buttons. 300 301**Since**: 12 302 303| Enum| Description| 304| -- | -- | 305| MOUSE_BUTTON_NONE = -1 | Invalid button.| 306| MOUSE_BUTTON_LEFT = 0 | Left button.| 307| MOUSE_BUTTON_MIDDLE = 1 | Middle button.| 308| MOUSE_BUTTON_RIGHT = 2 | Right button.| 309| MOUSE_BUTTON_FORWARD = 3 | Forward button.| 310| MOUSE_BUTTON_BACK = 4 | Back button.| 311 312### Input_TouchEventAction 313 314``` 315enum Input_TouchEventAction 316``` 317 318**Description** 319 320Provides the enum values of touch actions. 321 322**Since**: 12 323 324| Enum| Description| 325| -- | -- | 326| TOUCH_ACTION_CANCEL = 0 | Touch cancellation.| 327| TOUCH_ACTION_DOWN = 1 | Touch press.| 328| TOUCH_ACTION_MOVE = 2 | Touch moving.| 329| TOUCH_ACTION_UP = 3 | Touch release.| 330 331### Input_InjectionStatus 332 333``` 334enum Input_InjectionStatus 335``` 336 337**Description** 338 339Provides the enum values of injection permission states. 340 341**Since**: 20 342 343| Enum| Description| 344| -- | -- | 345| UNAUTHORIZED = 0 | Permission not granted.| 346| AUTHORIZING = 1 | Permission being granted.| 347| AUTHORIZED = 2 | Permission granted.| 348 349### InputEvent_SourceType 350 351``` 352enum InputEvent_SourceType 353``` 354 355**Description** 356 357Provides the enum values of event source types. 358 359**Since**: 12 360 361| Enum| Description| 362| -- | -- | 363| SOURCE_TYPE_MOUSE = 1 | Source that generates events similar to mouse cursor movement, button press and release, and wheel scrolling.| 364| SOURCE_TYPE_TOUCHSCREEN = 2 | Source that generates a touchscreen multi-touch event.| 365| SOURCE_TYPE_TOUCHPAD = 3 | Source that generates a touchscreen multi-touch event.| 366 367### Input_KeyboardType 368 369``` 370enum Input_KeyboardType 371``` 372 373**Description** 374 375Provides the enum values of keyboard types of the input device. 376 377**Since**: 13 378 379| Enum| Description| 380| -- | -- | 381| KEYBOARD_TYPE_NONE = 0 | Keyboard without keys.| 382| KEYBOARD_TYPE_UNKNOWN = 1 | Keyboard with unknown keys.| 383| KEYBOARD_TYPE_ALPHABETIC = 2 | Full keyboard.| 384| KEYBOARD_TYPE_DIGITAL = 3 | Numeric keypad.| 385| KEYBOARD_TYPE_STYLUS = 4 | Stylus.| 386| KEYBOARD_TYPE_REMOTE_CONTROL = 5 | Remote control.| 387 388### Input_Result 389 390``` 391enum Input_Result 392``` 393 394**Description** 395 396Provides the enum values of error codes. 397 398**Since**: 12 399 400| Enum| Description| 401| -- | -- | 402| INPUT_SUCCESS = 0 | Operation succeeded.| 403| INPUT_PERMISSION_DENIED = 201 | Permission verification failed.| 404| INPUT_NOT_SYSTEM_APPLICATION = 202 | Non-system application.| 405| INPUT_PARAMETER_ERROR = 401 | Parameter check fails.| 406| INPUT_DEVICE_NOT_SUPPORTED = 801 | Input device not supported.<br>**Since**: 14| 407| INPUT_SERVICE_EXCEPTION = 3800001 | Service error.| 408| INPUT_REPEAT_INTERCEPTOR = 4200001 | Interceptor repeatedly created.| 409| INPUT_OCCUPIED_BY_SYSTEM = 4200002 | Input device occupied by a system application.<br>**Since**: 14| 410| INPUT_OCCUPIED_BY_OTHER = 4200003 | Input device occupied by another application.<br>**Since**: 14| 411| INPUT_KEYBOARD_DEVICE_NOT_EXIST = 3900002 | Keyboard not connected.<br>**Since**: 15| 412| INPUT_INJECTION_AUTHORIZING = 3900005 | Authorization in progress.<br>**Since**: 20| 413| INPUT_INJECTION_OPERATION_FREQUENT = 3900006 | Repeated request.<br>**Since**: 20| 414| INPUT_INJECTION_AUTHORIZED = 3900007 | Permission granted to the current application.<br>**Since**: 20| 415| INPUT_INJECTION_AUTHORIZED_OTHERS = 3900008 | Permission granted to other applications.<br>**Since**: 20| 416| INPUT_APP_NOT_FOCUSED = 3900009 | Application not in focus.<br>**Since**: 20| 417| INPUT_DEVICE_NO_POINTER = 3900010 | No mouse device.<br>**Since**: 20| 418 419 420## Function Description 421 422### Input_HotkeyCallback() 423 424``` 425typedef void (*Input_HotkeyCallback)(Input_Hotkey* hotkey) 426``` 427 428**Description** 429 430Defines the callback used to return shortcut key events. 431 432**Since**: 14 433 434### Input_KeyEventCallback() 435 436``` 437typedef void (*Input_KeyEventCallback)(const Input_KeyEvent* keyEvent) 438``` 439 440**Description** 441 442Defines a lifecycle callback for **keyEvent**. If the callback is triggered, **keyEvent** will be destroyed. 443 444**Since**: 12 445 446 447**Parameters** 448 449| Parameter| Description| 450| -- | -- | 451| const [Input_KeyEvent](capi-input-input-keyevent.md)* keyEvent | Key event object. You can call [OH_Input_CreateKeyEvent](#oh_input_createkeyevent) to create a key event object.<br>If the key event object is no longer needed, destroy it by calling [OH_Input_DestroyKeyEvent](#oh_input_destroykeyevent).| 452 453### Input_MouseEventCallback() 454 455``` 456typedef void (*Input_MouseEventCallback)(const Input_MouseEvent* mouseEvent) 457``` 458 459**Description** 460 461Defines a lifecycle callback for **mouseEvent**. If the callback is triggered, **mouseEvent** will be destroyed. 462 463**Since**: 12 464 465 466**Parameters** 467 468| Parameter| Description| 469| -- | -- | 470| const [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 471 472### Input_TouchEventCallback() 473 474``` 475typedef void (*Input_TouchEventCallback)(const Input_TouchEvent* touchEvent) 476``` 477 478**Description** 479 480Defines a lifecycle callback for **touchEvent**. If the callback is triggered, **touchEvent** will be destroyed. 481 482**Since**: 12 483 484 485**Parameters** 486 487| Parameter| Description| 488| -- | -- | 489| const [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 490 491### Input_AxisEventCallback() 492 493``` 494typedef void (*Input_AxisEventCallback)(const Input_AxisEvent* axisEvent) 495``` 496 497**Description** 498 499Defines a lifecycle callback for **axisEvent**. If the callback is triggered, **axisEvent** will be destroyed. 500 501**Since**: 12 502 503 504**Parameters** 505 506| Parameter| Description| 507| -- | -- | 508| const [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 509 510### Input_DeviceAddedCallback() 511 512``` 513typedef void (*Input_DeviceAddedCallback)(int32_t deviceId) 514``` 515 516**Description** 517 518Defines a callback used to receive device insertion events. 519 520**Since**: 13 521 522 523**Parameters** 524 525| Parameter| Description| 526| -- | -- | 527| int32_t deviceId | Device ID.| 528 529### Input_DeviceRemovedCallback() 530 531``` 532typedef void (*Input_DeviceRemovedCallback)(int32_t deviceId) 533``` 534 535**Description** 536 537Defines a callback used to receive device removal events. 538 539**Since**: 13 540 541 542**Parameters** 543 544| Parameter| Description| 545| -- | -- | 546| int32_t deviceId | Device ID.| 547 548### Input_InjectAuthorizeCallback() 549 550``` 551typedef void (*Input_InjectAuthorizeCallback)(Input_InjectionStatus authorizedStatus) 552``` 553 554**Description** 555 556Defines a callback used to receive the injection permission authorization status. 557 558**Since**: 20 559 560 561**Parameters** 562 563| Parameter| Description| 564| -- | -- | 565| [Input_InjectionStatus](capi-oh-input-manager-h.md#input_injectionstatus) authorizedStatus | Injection permission authorization status.| 566 567### OH_Input_GetKeyState() 568 569``` 570Input_Result OH_Input_GetKeyState(struct Input_KeyState* keyState) 571``` 572 573**Description** 574 575Queries a key status enum object. 576 577**System capability**: SystemCapability.MultimodalInput.Input.Core 578 579**Since**: 12 580 581 582**Parameters** 583 584| Parameter| Description| 585| -- | -- | 586| struct [Input_KeyState](capi-input-input-keystate.md)* keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| 587 588**Return value** 589 590| Type| Description| 591| -- | -- | 592| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> an error code defined in [Input_Result](#input_result) otherwise.| 593 594### OH_Input_CreateKeyState() 595 596``` 597struct Input_KeyState* OH_Input_CreateKeyState() 598``` 599 600**Description** 601 602Creates a key status enum object. 603 604**System capability**: SystemCapability.MultimodalInput.Input.Core 605 606**Since**: 12 607 608**Return value** 609 610| Type| Description| 611| -- | -- | 612| struct | [Input_KeyState](capi-input-input-keystate.md) pointer object if the operation is successful; a null pointer otherwise.| 613 614### OH_Input_DestroyKeyState() 615 616``` 617void OH_Input_DestroyKeyState(struct Input_KeyState** keyState) 618``` 619 620**Description** 621 622Destroys a key status enum object. 623 624**System capability**: SystemCapability.MultimodalInput.Input.Core 625 626**Since**: 12 627 628 629**Parameters** 630 631| Parameter| Description| 632| -- | -- | 633| struct [Input_KeyState](capi-input-input-keystate.md)** keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| 634 635### OH_Input_SetKeyCode() 636 637``` 638void OH_Input_SetKeyCode(struct Input_KeyState* keyState, int32_t keyCode) 639``` 640 641**Description** 642 643Sets the key value of a key status enum object. 644 645**System capability**: SystemCapability.MultimodalInput.Input.Core 646 647**Since**: 12 648 649 650**Parameters** 651 652| Parameter| Description| 653| -- | -- | 654| struct [Input_KeyState](capi-input-input-keystate.md)* keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| 655| int32_t keyCode | Key code.| 656 657### OH_Input_GetKeyCode() 658 659``` 660int32_t OH_Input_GetKeyCode(const struct Input_KeyState* keyState) 661``` 662 663**Description** 664 665Obtains the key value of a key status enum object. 666 667**System capability**: SystemCapability.MultimodalInput.Input.Core 668 669**Since**: 12 670 671 672**Parameters** 673 674| Parameter| Description| 675| -- | -- | 676| const struct [Input_KeyState](capi-input-input-keystate.md)* keyState | Key status enum object. For details, see [Input_KeyStateAction](capi-oh-input-manager-h.md#input_keystateaction).| 677 678**Return value** 679 680| Type| Description| 681| -- | -- | 682| int32_t | Key value of the key status enum object.| 683 684### OH_Input_SetKeyPressed() 685 686``` 687void OH_Input_SetKeyPressed(struct Input_KeyState* keyState, int32_t keyAction) 688``` 689 690**Description** 691 692Sets whether the key specific to a key status enum object is pressed. 693 694**System capability**: SystemCapability.MultimodalInput.Input.Core 695 696**Since**: 12 697 698 699**Parameters** 700 701| Parameter| Description| 702| -- | -- | 703| struct [Input_KeyState](capi-input-input-keystate.md)* keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| 704| int32_t keyAction | Whether a key is pressed. For details, see [Input_KeyEventAction](#input_keyeventaction).| 705 706### OH_Input_GetKeyPressed() 707 708``` 709int32_t OH_Input_GetKeyPressed(const struct Input_KeyState* keyState) 710``` 711 712**Description** 713 714Checks whether the key specific to a key status enum object is pressed. 715 716**System capability**: SystemCapability.MultimodalInput.Input.Core 717 718**Since**: 12 719 720 721**Parameters** 722 723| Parameter| Description| 724| -- | -- | 725| const struct [Input_KeyState](capi-input-input-keystate.md)* keyState | Key status enum object. For details, see [Input_KeyStateAction](capi-oh-input-manager-h.md#input_keystateaction).| 726 727**Return value** 728 729| Type| Description| 730| -- | -- | 731| int32_t | Key pressing status of the key status enum object.| 732 733### OH_Input_SetKeySwitch() 734 735``` 736void OH_Input_SetKeySwitch(struct Input_KeyState* keyState, int32_t keySwitch) 737``` 738 739**Description** 740 741Sets the key switch of the key status enum object. 742 743**System capability**: SystemCapability.MultimodalInput.Input.Core 744 745**Since**: 12 746 747 748**Parameters** 749 750| Parameter| Description| 751| -- | -- | 752| struct [Input_KeyState](capi-input-input-keystate.md)* keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).| 753| int32_t keySwitch | Key switch.| 754 755### OH_Input_GetKeySwitch() 756 757``` 758int32_t OH_Input_GetKeySwitch(const struct Input_KeyState* keyState) 759``` 760 761**Description** 762 763Obtains the key switch of the key status enum object. 764 765**System capability**: SystemCapability.MultimodalInput.Input.Core 766 767**Since**: 12 768 769 770**Parameters** 771 772| Parameter| Description| 773| -- | -- | 774| const struct [Input_KeyState](capi-input-input-keystate.md)* keyState | Key status enum object. For details, see [Input_KeyStateAction](capi-oh-input-manager-h.md#input_keystateaction).| 775 776**Return value** 777 778| Type| Description| 779| -- | -- | 780| int32_t | Key switch of the key status enum object.| 781 782### OH_Input_InjectKeyEvent() 783 784``` 785int32_t OH_Input_InjectKeyEvent(const struct Input_KeyEvent* keyEvent) 786``` 787 788**Description** 789 790Injects a key event. 791 792This API does not take effect if the event injection permission is not granted. 793 794Since API version 20, you are advised to use [OH_Input_RequestInjection](#oh_input_requestinjection) to request the required permission before calling this API. If the status returned by [OH_Input_QueryAuthorizedStatus](#oh_input_queryauthorizedstatus) is [AUTHORIZED](capi-oh-input-manager-h.md#input_injectionstatus), then you can call this API. 795 796**System capability**: SystemCapability.MultimodalInput.Input.Core 797 798**Since**: 12 799 800 801**Parameters** 802 803| Parameter| Description| 804| -- | -- | 805| const struct [Input_KeyEvent](capi-input-input-keyevent.md)* keyEvent | Key event object. You can call [OH_Input_CreateKeyEvent](#oh_input_createkeyevent) to create a key event object.<br>If the key event object is no longer needed, destroy it by calling [OH_Input_DestroyKeyEvent](#oh_input_destroykeyevent).| 806 807**Return value** 808 809| Type| Description| 810| -- | -- | 811| int32_t | Error code of the **OH_Input_InjectKeyEvent** function:<br> - [INPUT_SUCCESS](capi-oh-input-manager-h.md#input_result) if the operation is successful.<br> - [INPUT_PERMISSION_DENIED](capi-oh-input-manager-h.md#input_result) if the required permission is missing. <br> - [INPUT_PARAMETER_ERROR](capi-oh-input-manager-h.md#input_result) if the input parameter is incorrect.| 812 813### OH_Input_CreateKeyEvent() 814 815``` 816struct Input_KeyEvent* OH_Input_CreateKeyEvent() 817``` 818 819**Description** 820 821Creates a key event object. 822 823**System capability**: SystemCapability.MultimodalInput.Input.Core 824 825**Since**: 12 826 827**Return value** 828 829| Type| Description| 830| -- | -- | 831| struct | [Input_KeyEvent](capi-input-input-keyevent.md) pointer object if the operation is successful; a null pointer otherwise.| 832 833### OH_Input_DestroyKeyEvent() 834 835``` 836void OH_Input_DestroyKeyEvent(struct Input_KeyEvent** keyEvent) 837``` 838 839**Description** 840 841Destroys a key event object. 842 843**System capability**: SystemCapability.MultimodalInput.Input.Core 844 845**Since**: 12 846 847 848**Parameters** 849 850| Parameter| Description| 851| -- | -- | 852| struct [Input_KeyEvent](capi-input-input-keyevent.md)** keyEvent | Key event object.| 853 854### OH_Input_SetKeyEventAction() 855 856``` 857void OH_Input_SetKeyEventAction(struct Input_KeyEvent* keyEvent, int32_t action) 858``` 859 860**Description** 861 862Sets the key event type. 863 864**System capability**: SystemCapability.MultimodalInput.Input.Core 865 866**Since**: 12 867 868 869**Parameters** 870 871| Parameter| Description| 872| -- | -- | 873| struct [Input_KeyEvent](capi-input-input-keyevent.md)* keyEvent | Key event object. You can call [OH_Input_CreateKeyEvent](#oh_input_createkeyevent) to create a key event object.<br>If the key event object is no longer needed, destroy it by calling [OH_Input_DestroyKeyEvent](#oh_input_destroykeyevent).| 874| int32_t action | Key event type. For details, see [Input_KeyEventAction](#input_keyeventaction).| 875 876### OH_Input_GetKeyEventAction() 877 878``` 879int32_t OH_Input_GetKeyEventAction(const struct Input_KeyEvent* keyEvent) 880``` 881 882**Description** 883 884Obtains the key event action. 885 886**System capability**: SystemCapability.MultimodalInput.Input.Core 887 888**Since**: 12 889 890 891**Parameters** 892 893| Parameter| Description| 894| -- | -- | 895| const struct [Input_KeyEvent](capi-input-input-keyevent.md)* keyEvent | Key event object. You can call [OH_Input_CreateKeyEvent](#oh_input_createkeyevent) to create a key event object.<br>If the key event object is no longer needed, destroy it by calling [OH_Input_DestroyKeyEvent](#oh_input_destroykeyevent).| 896 897**Return value** 898 899| Type| Description| 900| -- | -- | 901| int32_t | Key event type. For details, see [Input_KeyEventAction](#input_keyeventaction).| 902 903### OH_Input_SetKeyEventKeyCode() 904 905``` 906void OH_Input_SetKeyEventKeyCode(struct Input_KeyEvent* keyEvent, int32_t keyCode) 907``` 908 909**Description** 910 911Sets the key code value for a key event. 912 913**System capability**: SystemCapability.MultimodalInput.Input.Core 914 915**Since**: 12 916 917 918**Parameters** 919 920| Parameter| Description| 921| -- | -- | 922| struct [Input_KeyEvent](capi-input-input-keyevent.md)* keyEvent | Key event object. You can call [OH_Input_CreateKeyEvent](#oh_input_createkeyevent) to create a key event object.<br>If the key event object is no longer needed, destroy it by calling [OH_Input_DestroyKeyEvent](#oh_input_destroykeyevent).| 923| int32_t keyCode | Key value.| 924 925### OH_Input_GetKeyEventKeyCode() 926 927``` 928int32_t OH_Input_GetKeyEventKeyCode(const struct Input_KeyEvent* keyEvent) 929``` 930 931**Description** 932 933Obtains the key code value of a key event. 934 935**System capability**: SystemCapability.MultimodalInput.Input.Core 936 937**Since**: 12 938 939 940**Parameters** 941 942| Parameter| Description| 943| -- | -- | 944| const struct [Input_KeyEvent](capi-input-input-keyevent.md)* keyEvent | Key event object. You can call [OH_Input_CreateKeyEvent](#oh_input_createkeyevent) to create a key event object.<br>If the key event object is no longer needed, destroy it by calling [OH_Input_DestroyKeyEvent](#oh_input_destroykeyevent).| 945 946**Return value** 947 948| Type| Description| 949| -- | -- | 950| int32_t | Key code. | 951 952### OH_Input_SetKeyEventActionTime() 953 954``` 955void OH_Input_SetKeyEventActionTime(struct Input_KeyEvent* keyEvent, int64_t actionTime) 956``` 957 958**Description** 959 960Sets the time when a key event occurs. 961 962**System capability**: SystemCapability.MultimodalInput.Input.Core 963 964**Since**: 12 965 966 967**Parameters** 968 969| Parameter| Description| 970| -- | -- | 971| struct [Input_KeyEvent](capi-input-input-keyevent.md)* keyEvent | Key event object. You can call [OH_Input_CreateKeyEvent](#oh_input_createkeyevent) to create a key event object.<br>If the key event object is no longer needed, destroy it by calling [OH_Input_DestroyKeyEvent](#oh_input_destroykeyevent).| 972| int64_t actionTime | Key event timestamp, which is measured as the number of milliseconds that have elapsed since the Unix epoch.| 973 974### OH_Input_GetKeyEventActionTime() 975 976``` 977int64_t OH_Input_GetKeyEventActionTime(const struct Input_KeyEvent* keyEvent) 978``` 979 980**Description** 981 982Obtains the time when a key event occurs. 983 984**System capability**: SystemCapability.MultimodalInput.Input.Core 985 986**Since**: 12 987 988 989**Parameters** 990 991| Parameter| Description| 992| -- | -- | 993| const struct [Input_KeyEvent](capi-input-input-keyevent.md)* keyEvent | Key event object. You can call [OH_Input_CreateKeyEvent](#oh_input_createkeyevent) to create a key event object.<br>If the key event object is no longer needed, destroy it by calling [OH_Input_DestroyKeyEvent](#oh_input_destroykeyevent).| 994 995**Return value** 996 997| Type| Description| 998| -- | -- | 999| int64_t | Time when a key event occurs.| 1000 1001### OH_Input_SetKeyEventWindowId() 1002 1003``` 1004void OH_Input_SetKeyEventWindowId(struct Input_KeyEvent* keyEvent, int32_t windowId) 1005``` 1006 1007**Description** 1008 1009Sets the window ID of a key event. 1010 1011**System capability**: SystemCapability.MultimodalInput.Input.Core 1012 1013**Since**: 15 1014 1015 1016**Parameters** 1017 1018| Parameter| Description| 1019| -- | -- | 1020| struct [Input_KeyEvent](capi-input-input-keyevent.md)* keyEvent | Key event object. You can call [OH_Input_CreateKeyEvent](#oh_input_createkeyevent) to create a key event object.<br>If the key event object is no longer needed, destroy it by calling [OH_Input_DestroyKeyEvent](#oh_input_destroykeyevent).| 1021| int32_t windowId | Window ID of the key event.| 1022 1023### OH_Input_GetKeyEventWindowId() 1024 1025``` 1026int32_t OH_Input_GetKeyEventWindowId(const struct Input_KeyEvent* keyEvent) 1027``` 1028 1029**Description** 1030 1031Obtains the window ID of a key event. 1032 1033**System capability**: SystemCapability.MultimodalInput.Input.Core 1034 1035**Since**: 15 1036 1037 1038**Parameters** 1039 1040| Parameter| Description| 1041| -- | -- | 1042| const struct [Input_KeyEvent](capi-input-input-keyevent.md)* keyEvent | Key event object. You can call [OH_Input_CreateKeyEvent](#oh_input_createkeyevent) to create a key event object.<br>If the key event object is no longer needed, destroy it by calling [OH_Input_DestroyKeyEvent](#oh_input_destroykeyevent).| 1043 1044**Return value** 1045 1046| Type| Description| 1047| -- | -- | 1048| int32_t | Window ID of the key event.| 1049 1050### OH_Input_GetKeyEventDisplayId() 1051 1052``` 1053int32_t OH_Input_GetKeyEventDisplayId(const struct Input_KeyEvent* keyEvent) 1054``` 1055 1056**Description** 1057 1058Obtains the screen ID of a key event. 1059 1060**System capability**: SystemCapability.MultimodalInput.Input.Core 1061 1062**Since**: 15 1063 1064 1065**Parameters** 1066 1067| Parameter| Description| 1068| -- | -- | 1069| const struct [Input_KeyEvent](capi-input-input-keyevent.md)* keyEvent | Key event object. You can call [OH_Input_CreateKeyEvent](#oh_input_createkeyevent) to create a key event object.<br>If the key event object is no longer needed, destroy it by calling [OH_Input_DestroyKeyEvent](#oh_input_destroykeyevent).| 1070 1071**Return value** 1072 1073| Type| Description| 1074| -- | -- | 1075| int32_t | Screen ID of the key event.| 1076 1077### OH_Input_SetKeyEventDisplayId() 1078 1079``` 1080void OH_Input_SetKeyEventDisplayId(struct Input_KeyEvent* keyEvent, int32_t displayId) 1081``` 1082 1083**Description** 1084 1085Sets the screen ID of a key event. 1086 1087**System capability**: SystemCapability.MultimodalInput.Input.Core 1088 1089**Since**: 15 1090 1091 1092**Parameters** 1093 1094| Parameter| Description| 1095| -- | -- | 1096| struct [Input_KeyEvent](capi-input-input-keyevent.md)* keyEvent | Key event object. You can call [OH_Input_CreateKeyEvent](#oh_input_createkeyevent) to create a key event object.<br>If the key event object is no longer needed, destroy it by calling [OH_Input_DestroyKeyEvent](#oh_input_destroykeyevent).| 1097| int32_t displayId | Screen ID of the key event.| 1098 1099### OH_Input_CreateMouseEvent() 1100 1101``` 1102struct Input_MouseEvent* OH_Input_CreateMouseEvent() 1103``` 1104 1105**Description** 1106 1107Creates a mouse event object. 1108 1109**System capability**: SystemCapability.MultimodalInput.Input.Core 1110 1111**Since**: 12 1112 1113**Return value** 1114 1115| Type| Description| 1116| -- | -- | 1117| struct | [Input_MouseEvent](capi-input-input-mouseevent.md) pointer object if the operation is successful; a null pointer otherwise.| 1118 1119### OH_Input_DestroyMouseEvent() 1120 1121``` 1122void OH_Input_DestroyMouseEvent(struct Input_MouseEvent** mouseEvent) 1123``` 1124 1125**Description** 1126 1127Destroys a mouse event object. 1128 1129**System capability**: SystemCapability.MultimodalInput.Input.Core 1130 1131**Since**: 12 1132 1133 1134**Parameters** 1135 1136| Parameter| Description| 1137| -- | -- | 1138| struct [Input_MouseEvent](capi-input-input-mouseevent.md)** mouseEvent | Mouse event object.| 1139 1140### OH_Input_SetMouseEventAction() 1141 1142``` 1143void OH_Input_SetMouseEventAction(struct Input_MouseEvent* mouseEvent, int32_t action) 1144``` 1145 1146**Description** 1147 1148Sets the action for a mouse event. 1149 1150**System capability**: SystemCapability.MultimodalInput.Input.Core 1151 1152**Since**: 12 1153 1154 1155**Parameters** 1156 1157| Parameter| Description| 1158| -- | -- | 1159| struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1160| int32_t action | Mouse action. For details, see [Input_MouseEventAction](#input_mouseeventaction).| 1161 1162### OH_Input_GetMouseEventAction() 1163 1164``` 1165int32_t OH_Input_GetMouseEventAction(const struct Input_MouseEvent* mouseEvent) 1166``` 1167 1168**Description** 1169 1170Obtains the action of a mouse event. 1171 1172**System capability**: SystemCapability.MultimodalInput.Input.Core 1173 1174**Since**: 12 1175 1176 1177**Parameters** 1178 1179| Parameter| Description| 1180| -- | -- | 1181| const struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1182 1183**Return value** 1184 1185| Type| Description| 1186| -- | -- | 1187| int32_t | Mouse action.| 1188 1189### OH_Input_SetMouseEventDisplayX() 1190 1191``` 1192void OH_Input_SetMouseEventDisplayX(struct Input_MouseEvent* mouseEvent, int32_t displayX) 1193``` 1194 1195**Description** 1196 1197Sets the X coordinate of the mouse event in the relative coordinate system with the upper-left corner of the specified screen as the origin. 1198 1199**System capability**: SystemCapability.MultimodalInput.Input.Core 1200 1201**Since**: 12 1202 1203 1204**Parameters** 1205 1206| Parameter| Description| 1207| -- | -- | 1208| struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1209| int32_t displayX | X coordinate of the mouse event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 1210 1211### OH_Input_GetMouseEventDisplayX() 1212 1213``` 1214int32_t OH_Input_GetMouseEventDisplayX(const struct Input_MouseEvent* mouseEvent) 1215``` 1216 1217**Description** 1218 1219Obtains the X coordinate of the mouse event in the relative coordinate system with the upper-left corner of the specified screen as the origin. 1220 1221**System capability**: SystemCapability.MultimodalInput.Input.Core 1222 1223**Since**: 12 1224 1225 1226**Parameters** 1227 1228| Parameter| Description| 1229| -- | -- | 1230| const struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1231 1232**Return value** 1233 1234| Type| Description| 1235| -- | -- | 1236| int32_t | X coordinate of the mouse event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 1237 1238### OH_Input_SetMouseEventDisplayY() 1239 1240``` 1241void OH_Input_SetMouseEventDisplayY(struct Input_MouseEvent* mouseEvent, int32_t displayY) 1242``` 1243 1244**Description** 1245 1246Sets the Y coordinate of the mouse event in the relative coordinate system with the upper-left corner of the specified screen as the origin. 1247 1248**System capability**: SystemCapability.MultimodalInput.Input.Core 1249 1250**Since**: 12 1251 1252 1253**Parameters** 1254 1255| Parameter| Description| 1256| -- | -- | 1257| struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1258| int32_t displayY | Y coordinate of the mouse event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 1259 1260### OH_Input_GetMouseEventDisplayY() 1261 1262``` 1263int32_t OH_Input_GetMouseEventDisplayY(const struct Input_MouseEvent* mouseEvent) 1264``` 1265 1266**Description** 1267 1268Obtains the Y coordinate of the mouse event in the relative coordinate system with the upper-left corner of the specified screen as the origin. 1269 1270**System capability**: SystemCapability.MultimodalInput.Input.Core 1271 1272**Since**: 12 1273 1274 1275**Parameters** 1276 1277| Parameter| Description| 1278| -- | -- | 1279| const struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1280 1281**Return value** 1282 1283| Type| Description| 1284| -- | -- | 1285| int32_t | Y coordinate of the mouse event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 1286 1287### OH_Input_SetMouseEventButton() 1288 1289``` 1290void OH_Input_SetMouseEventButton(struct Input_MouseEvent* mouseEvent, int32_t button) 1291``` 1292 1293**Description** 1294 1295Sets the button for a mouse event. 1296 1297**System capability**: SystemCapability.MultimodalInput.Input.Core 1298 1299**Since**: 12 1300 1301 1302**Parameters** 1303 1304| Parameter| Description| 1305| -- | -- | 1306| struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1307| int32_t button | Mouse button. For details, see [Input_MouseEventButton](#input_mouseeventbutton).| 1308 1309### OH_Input_GetMouseEventButton() 1310 1311``` 1312int32_t OH_Input_GetMouseEventButton(const struct Input_MouseEvent* mouseEvent) 1313``` 1314 1315**Description** 1316 1317Obtains the button of a mouse event. 1318 1319**System capability**: SystemCapability.MultimodalInput.Input.Core 1320 1321**Since**: 12 1322 1323 1324**Parameters** 1325 1326| Parameter| Description| 1327| -- | -- | 1328| const struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1329 1330**Return value** 1331 1332| Type| Description| 1333| -- | -- | 1334| int32_t | Mouse button. For details, see [Input_MouseEventButton](#input_mouseeventbutton).| 1335 1336### OH_Input_SetMouseEventAxisType() 1337 1338``` 1339void OH_Input_SetMouseEventAxisType(struct Input_MouseEvent* mouseEvent, int32_t axisType) 1340``` 1341 1342**Description** 1343 1344Sets the axis type for a mouse event. 1345 1346**System capability**: SystemCapability.MultimodalInput.Input.Core 1347 1348**Since**: 12 1349 1350 1351**Parameters** 1352 1353| Parameter| Description| 1354| -- | -- | 1355| struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1356| int32_t axisType | Axis type, for example, X axis or Y axis. For details, see [InputEvent_MouseAxis](#inputevent_mouseaxis).| 1357 1358### OH_Input_GetMouseEventAxisType() 1359 1360``` 1361int32_t OH_Input_GetMouseEventAxisType(const struct Input_MouseEvent* mouseEvent) 1362``` 1363 1364**Description** 1365 1366Obtains the axis type of a mouse event. 1367 1368**System capability**: SystemCapability.MultimodalInput.Input.Core 1369 1370**Since**: 12 1371 1372 1373**Parameters** 1374 1375| Parameter| Description| 1376| -- | -- | 1377| const struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1378 1379**Return value** 1380 1381| Type| Description| 1382| -- | -- | 1383| int32_t | Axis type. For details, see [InputEvent_MouseAxis](#inputevent_mouseaxis).| 1384 1385### OH_Input_SetMouseEventAxisValue() 1386 1387``` 1388void OH_Input_SetMouseEventAxisValue(struct Input_MouseEvent* mouseEvent, float axisValue) 1389``` 1390 1391**Description** 1392 1393Sets the axis value for a mouse axis event. 1394 1395**System capability**: SystemCapability.MultimodalInput.Input.Core 1396 1397**Since**: 12 1398 1399 1400**Parameters** 1401 1402| Parameter| Description| 1403| -- | -- | 1404| struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1405| float axisValue | Axis event value. A positive number means scrolling forward (for example, 1.0 equals one unit forward), and a negative number means scrolling backward (for example, -1.0 equals one unit backward).| 1406 1407### OH_Input_GetMouseEventAxisValue() 1408 1409``` 1410float OH_Input_GetMouseEventAxisValue(const struct Input_MouseEvent* mouseEvent) 1411``` 1412 1413**Description** 1414 1415Obtains the axis value of a mouse axis event. 1416 1417**System capability**: SystemCapability.MultimodalInput.Input.Core 1418 1419**Since**: 12 1420 1421 1422**Parameters** 1423 1424| Parameter| Description| 1425| -- | -- | 1426| const struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1427 1428**Return value** 1429 1430| Type| Description| 1431| -- | -- | 1432| float | Axis event value.| 1433 1434### OH_Input_SetMouseEventActionTime() 1435 1436``` 1437void OH_Input_SetMouseEventActionTime(struct Input_MouseEvent* mouseEvent, int64_t actionTime) 1438``` 1439 1440**Description** 1441 1442Sets the time when a mouse event occurs. 1443 1444**System capability**: SystemCapability.MultimodalInput.Input.Core 1445 1446**Since**: 12 1447 1448 1449**Parameters** 1450 1451| Parameter| Description| 1452| -- | -- | 1453| struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1454| int64_t actionTime | Mouse event timestamp, which is measured as the number of milliseconds that have elapsed since the Unix epoch.| 1455 1456### OH_Input_GetMouseEventActionTime() 1457 1458``` 1459int64_t OH_Input_GetMouseEventActionTime(const struct Input_MouseEvent* mouseEvent) 1460``` 1461 1462**Description** 1463 1464Obtains the time when a mouse event occurs. 1465 1466**System capability**: SystemCapability.MultimodalInput.Input.Core 1467 1468**Since**: 12 1469 1470 1471**Parameters** 1472 1473| Parameter| Description| 1474| -- | -- | 1475| mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1476 1477**Return value** 1478 1479| Type| Description| 1480| -- | -- | 1481| int64_t | Time when the mouse event occurs.| 1482 1483### OH_Input_SetMouseEventWindowId() 1484 1485``` 1486void OH_Input_SetMouseEventWindowId(struct Input_MouseEvent* mouseEvent, int32_t windowId) 1487``` 1488 1489**Description** 1490 1491Sets the window ID of a mouse event. 1492 1493**System capability**: SystemCapability.MultimodalInput.Input.Core 1494 1495**Since**: 15 1496 1497 1498**Parameters** 1499 1500| Parameter| Description| 1501| -- | -- | 1502| struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1503| int32_t windowId | Window ID of the mouse event.| 1504 1505### OH_Input_GetMouseEventWindowId() 1506 1507``` 1508int32_t OH_Input_GetMouseEventWindowId(const struct Input_MouseEvent* mouseEvent) 1509``` 1510 1511**Description** 1512 1513Obtains the window ID of a mouse event. 1514 1515**System capability**: SystemCapability.MultimodalInput.Input.Core 1516 1517**Since**: 15 1518 1519 1520**Parameters** 1521 1522| Parameter| Description| 1523| -- | -- | 1524| const struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1525 1526**Return value** 1527 1528| Type| Description| 1529| -- | -- | 1530| int32_t | Window ID of the mouse event.| 1531 1532### OH_Input_SetMouseEventDisplayId() 1533 1534``` 1535void OH_Input_SetMouseEventDisplayId(struct Input_MouseEvent* mouseEvent, int32_t displayId) 1536``` 1537 1538**Description** 1539 1540Sets the screen ID of a mouse event. 1541 1542**System capability**: SystemCapability.MultimodalInput.Input.Core 1543 1544**Since**: 15 1545 1546 1547**Parameters** 1548 1549| Parameter| Description| 1550| -- | -- | 1551| struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 1552| int32_t displayId | Screen ID of the mouse event.| 1553 1554### OH_Input_CreateTouchEvent() 1555 1556``` 1557struct Input_TouchEvent* OH_Input_CreateTouchEvent() 1558``` 1559 1560**Description** 1561 1562Creates a touch event object. 1563 1564**System capability**: SystemCapability.MultimodalInput.Input.Core 1565 1566**Since**: 12 1567 1568**Return value** 1569 1570| Type| Description| 1571| -- | -- | 1572| struct | [Input_TouchEvent](capi-input-input-touchevent.md) pointer object if the operation is successful; a null pointer otherwise.| 1573 1574### OH_Input_DestroyTouchEvent() 1575 1576``` 1577void OH_Input_DestroyTouchEvent(struct Input_TouchEvent** touchEvent) 1578``` 1579 1580**Description** 1581 1582Destroys a touch event object. 1583 1584**System capability**: SystemCapability.MultimodalInput.Input.Core 1585 1586**Since**: 12 1587 1588 1589**Parameters** 1590 1591| Parameter| Description| 1592| -- | -- | 1593| struct [Input_TouchEvent](capi-input-input-touchevent.md)** touchEvent | Touch event object.| 1594 1595### OH_Input_SetTouchEventAction() 1596 1597``` 1598void OH_Input_SetTouchEventAction(struct Input_TouchEvent* touchEvent, int32_t action) 1599``` 1600 1601**Description** 1602 1603Sets the action for a touch event. 1604 1605**System capability**: SystemCapability.MultimodalInput.Input.Core 1606 1607**Since**: 12 1608 1609 1610**Parameters** 1611 1612| Parameter| Description| 1613| -- | -- | 1614| struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 1615| int32_t action | Action of the touch event. For details, see [Input_TouchEventAction](#input_toucheventaction).| 1616 1617### OH_Input_GetTouchEventAction() 1618 1619``` 1620int32_t OH_Input_GetTouchEventAction(const struct Input_TouchEvent* touchEvent) 1621``` 1622 1623**Description** 1624 1625Obtains the action of a touch event. 1626 1627**System capability**: SystemCapability.MultimodalInput.Input.Core 1628 1629**Since**: 12 1630 1631 1632**Parameters** 1633 1634| Parameter| Description| 1635| -- | -- | 1636| const struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 1637 1638**Return value** 1639 1640| Type| Description| 1641| -- | -- | 1642| int32_t | Action of the touch event. For details, see [Input_TouchEventAction](#input_toucheventaction).| 1643 1644### OH_Input_SetTouchEventFingerId() 1645 1646``` 1647void OH_Input_SetTouchEventFingerId(struct Input_TouchEvent* touchEvent, int32_t id) 1648``` 1649 1650**Description** 1651 1652Sets the finger ID for a touch event. 1653 1654**System capability**: SystemCapability.MultimodalInput.Input.Core 1655 1656**Since**: 12 1657 1658 1659**Parameters** 1660 1661| Parameter| Description| 1662| -- | -- | 1663| struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 1664| int32_t id | Finger ID of a touch event. The ID of the first finger touching the screen is 0, the second is 1, and so on incrementally.| 1665 1666### OH_Input_GetTouchEventFingerId() 1667 1668``` 1669int32_t OH_Input_GetTouchEventFingerId(const struct Input_TouchEvent* touchEvent) 1670``` 1671 1672**Description** 1673 1674Obtains the finger ID of a touch event. 1675 1676**System capability**: SystemCapability.MultimodalInput.Input.Core 1677 1678**Since**: 12 1679 1680 1681**Parameters** 1682 1683| Parameter| Description| 1684| -- | -- | 1685| const struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 1686 1687**Return value** 1688 1689| Type| Description| 1690| -- | -- | 1691| int32_t | Finger ID of a touch event. The ID of the first finger touching the screen is 0, the second is 1, and so on incrementally.| 1692 1693### OH_Input_SetTouchEventDisplayX() 1694 1695``` 1696void OH_Input_SetTouchEventDisplayX(struct Input_TouchEvent* touchEvent, int32_t displayX) 1697``` 1698 1699**Description** 1700 1701Sets the X coordinate of the touch event in the relative coordinate system with the upper-left corner of the specified screen as the origin. 1702 1703**System capability**: SystemCapability.MultimodalInput.Input.Core 1704 1705**Since**: 12 1706 1707 1708**Parameters** 1709 1710| Parameter| Description| 1711| -- | -- | 1712| struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 1713| int32_t displayX | X coordinate of the touch event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 1714 1715### OH_Input_GetTouchEventDisplayX() 1716 1717``` 1718int32_t OH_Input_GetTouchEventDisplayX(const struct Input_TouchEvent* touchEvent) 1719``` 1720 1721**Description** 1722 1723Obtains the X coordinate of the touch event in the relative coordinate system with the upper-left corner of the specified screen as the origin. 1724 1725**System capability**: SystemCapability.MultimodalInput.Input.Core 1726 1727**Since**: 12 1728 1729 1730**Parameters** 1731 1732| Parameter| Description| 1733| -- | -- | 1734| const struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 1735 1736**Return value** 1737 1738| Type| Description| 1739| -- | -- | 1740| int32_t | X coordinate of the touch event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 1741 1742### OH_Input_SetTouchEventDisplayY() 1743 1744``` 1745void OH_Input_SetTouchEventDisplayY(struct Input_TouchEvent* touchEvent, int32_t displayY) 1746``` 1747 1748**Description** 1749 1750Sets the Y coordinate of the touch event in the relative coordinate system with the upper-left corner of the specified screen as the origin. 1751 1752**System capability**: SystemCapability.MultimodalInput.Input.Core 1753 1754**Since**: 12 1755 1756 1757**Parameters** 1758 1759| Parameter| Description| 1760| -- | -- | 1761| struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 1762| int32_t displayY | Y coordinate of the touch event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 1763 1764### OH_Input_GetTouchEventDisplayY() 1765 1766``` 1767int32_t OH_Input_GetTouchEventDisplayY(const struct Input_TouchEvent* touchEvent) 1768``` 1769 1770**Description** 1771 1772Obtains the Y coordinate of the touch event in the relative coordinate system with the upper-left corner of the specified screen as the origin. 1773 1774**System capability**: SystemCapability.MultimodalInput.Input.Core 1775 1776**Since**: 12 1777 1778 1779**Parameters** 1780 1781| Parameter| Description| 1782| -- | -- | 1783| const struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 1784 1785**Return value** 1786 1787| Type| Description| 1788| -- | -- | 1789| int32_t | Y coordinate of the touch event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 1790 1791### OH_Input_SetTouchEventActionTime() 1792 1793``` 1794void OH_Input_SetTouchEventActionTime(struct Input_TouchEvent* touchEvent, int64_t actionTime) 1795``` 1796 1797**Description** 1798 1799Sets the time when a touch event occurs. 1800 1801**System capability**: SystemCapability.MultimodalInput.Input.Core 1802 1803**Since**: 12 1804 1805 1806**Parameters** 1807 1808| Parameter| Description| 1809| -- | -- | 1810| touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 1811| int64_t actionTime | Touch event timestamp, which is measured as the number of milliseconds that have elapsed since the Unix epoch.| 1812 1813### OH_Input_GetTouchEventActionTime() 1814 1815``` 1816int64_t OH_Input_GetTouchEventActionTime(const struct Input_TouchEvent* touchEvent) 1817``` 1818 1819**Description** 1820 1821Obtains the time when a touch event occurs. 1822 1823**System capability**: SystemCapability.MultimodalInput.Input.Core 1824 1825**Since**: 12 1826 1827 1828**Parameters** 1829 1830| Parameter| Description| 1831| -- | -- | 1832| touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 1833 1834**Return value** 1835 1836| Type| Description| 1837| -- | -- | 1838| int64_t | Time when the touch event occurs.| 1839 1840### OH_Input_SetTouchEventWindowId() 1841 1842``` 1843void OH_Input_SetTouchEventWindowId(struct Input_TouchEvent* touchEvent, int32_t windowId) 1844``` 1845 1846**Description** 1847 1848Sets the window ID of a touch event. 1849 1850**System capability**: SystemCapability.MultimodalInput.Input.Core 1851 1852**Since**: 15 1853 1854 1855**Parameters** 1856 1857| Parameter| Description| 1858| -- | -- | 1859| struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 1860| int32_t windowId | Window ID of the touch event.| 1861 1862### OH_Input_GetTouchEventWindowId() 1863 1864``` 1865int32_t OH_Input_GetTouchEventWindowId(const struct Input_TouchEvent* touchEvent) 1866``` 1867 1868**Description** 1869 1870Obtains the window ID of a touch event. 1871 1872**System capability**: SystemCapability.MultimodalInput.Input.Core 1873 1874**Since**: 15 1875 1876 1877**Parameters** 1878 1879| Parameter| Description| 1880| -- | -- | 1881| const struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 1882 1883**Return value** 1884 1885| Type| Description| 1886| -- | -- | 1887| int32_t | Window ID of the touch event.| 1888 1889### OH_Input_SetTouchEventDisplayId() 1890 1891``` 1892void OH_Input_SetTouchEventDisplayId(struct Input_TouchEvent* touchEvent, int32_t displayId) 1893``` 1894 1895**Description** 1896 1897Sets the screen ID of a touch event. 1898 1899**System capability**: SystemCapability.MultimodalInput.Input.Core 1900 1901**Since**: 15 1902 1903 1904**Parameters** 1905 1906| Parameter| Description| 1907| -- | -- | 1908| struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 1909| int32_t displayId | Screen ID of the touch event.| 1910 1911### OH_Input_GetTouchEventDisplayId() 1912 1913``` 1914int32_t OH_Input_GetTouchEventDisplayId(const struct Input_TouchEvent* touchEvent) 1915``` 1916 1917**Description** 1918 1919Obtains the screen ID of a touch event. 1920 1921**System capability**: SystemCapability.MultimodalInput.Input.Core 1922 1923**Since**: 15 1924 1925 1926**Parameters** 1927 1928| Parameter| Description| 1929| -- | -- | 1930| const struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 1931 1932**Return value** 1933 1934| Type| Description| 1935| -- | -- | 1936| int32_t | Screen ID of the touch event.| 1937 1938### OH_Input_CancelInjection() 1939 1940``` 1941void OH_Input_CancelInjection() 1942``` 1943 1944**Description** 1945 1946Stops event injection and revokes authorization. 1947 1948**System capability**: SystemCapability.MultimodalInput.Input.Core 1949 1950**Since**: 12 1951 1952### OH_Input_RequestInjection() 1953 1954``` 1955Input_Result OH_Input_RequestInjection(Input_InjectAuthorizeCallback callback) 1956``` 1957 1958**Description** 1959 1960Requests the permission for [OH_Input_InjectKeyEvent](capi-oh-input-manager-h.md#oh_input_injectkeyevent), [OH_Input_InjectTouchEvent](capi-oh-input-manager-h.md#oh_input_injecttouchevent), and [OH_Input_InjectMouseEvent](capi-oh-input-manager-h.md#oh_input_injectmouseevent). This API takes effect only on PCs/2-in-1 devices. 1961 1962**Since**: 20 1963 1964 1965**Parameters** 1966 1967| Parameter| Description| 1968| -- | -- | 1969| [Input_InjectAuthorizeCallback](capi-oh-input-manager-h.md#input_injectauthorizecallback) callback | Callback used to return the permission authorization status. For details, see [Input_InjectAuthorizeCallback](capi-oh-input-manager-h.md#input_injectauthorizecallback).| 1970 1971**Return value** 1972 1973| Type| Description| 1974| -- | -- | 1975| [Input_Result](capi-oh-input-manager-h.md#input_result) | Result code. For details, see [Input_Result](capi-oh-input-manager-h.md#input_result).<br> INPUT_SUCCESS = 0: Operation success. The application waits for the user authorization result and returns the authorization status through a callback.<br> INPUT_PARAMETER_ERROR = 401: Parameter error. The callback parameter is empty.<br> INPUT_DEVICE_NOT_SUPPORTED = 801: Device not supported.<br> INPUT_SERVICE_EXCEPTION = 3800001: Server error.<br> INPUT_INJECTION_AUTHORIZING = 3900005: Permission being granted.<br> INPUT_INJECTION_OPERATION_FREQUENT = 3900006: Repeated request. The application continuously requests permission authorization at an interval of no more than 3 seconds.<br> INPUT_INJECTION_AUTHORIZED = 3900007: Permission granted.<br> INPUT_INJECTION_AUTHORIZED_OTHERS = 3900008: Permission granted to other applications.| 1976 1977### OH_Input_QueryAuthorizedStatus() 1978 1979``` 1980Input_Result OH_Input_QueryAuthorizedStatus(Input_InjectionStatus* status) 1981``` 1982 1983**Description** 1984 1985Queries the injection permission authorization status of the current application. 1986 1987**Since**: 20 1988 1989 1990**Parameters** 1991 1992| Parameter| Description| 1993| -- | -- | 1994| [Input_InjectionStatus](capi-oh-input-manager-h.md#input_injectionstatus)* status | Injection permission authorization status of the current application. See [Input_InjectionStatus](capi-oh-input-manager-h.md#input_injectionstatus).| 1995 1996**Return value** 1997 1998| Type| Description| 1999| -- | -- | 2000| [Input_Result](capi-oh-input-manager-h.md#input_result) | Result code. For details, see [Input_Result](capi-oh-input-manager-h.md#input_result).<br> INPUT_SUCCESS = 0: Operation success.<br> INPUT_PARAMETER_ERROR = 401: Parameter error. The status parameter is empty.<br> INPUT_SERVICE_EXCEPTION = 3800001: Server error.| 2001 2002### OH_Input_CreateAxisEvent() 2003 2004``` 2005Input_AxisEvent* OH_Input_CreateAxisEvent(void) 2006``` 2007 2008**Description** 2009 2010Creates an axis event object. 2011 2012**System capability**: SystemCapability.MultimodalInput.Input.Core 2013 2014**Since**: 12 2015 2016**Return value** 2017 2018| Type| Description| 2019| -- | -- | 2020| Input_AxisEvent* | [Input_AxisEvent](capi-input-input-axisevent.md) object if the operation is successful; **null** otherwise.| 2021 2022### OH_Input_DestroyAxisEvent() 2023 2024``` 2025Input_Result OH_Input_DestroyAxisEvent(Input_AxisEvent** axisEvent) 2026``` 2027 2028**Description** 2029 2030Destroys an axis event object. 2031 2032**System capability**: SystemCapability.MultimodalInput.Input.Core 2033 2034**Since**: 12 2035 2036 2037**Parameters** 2038 2039| Parameter| Description| 2040| -- | -- | 2041| [Input_AxisEvent](capi-input-input-axisevent.md)** axisEvent | Pointer to the axis event object.| 2042 2043**Return value** 2044 2045| Type| Description| 2046| -- | -- | 2047| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** is null.| 2048 2049### OH_Input_SetAxisEventAction() 2050 2051``` 2052Input_Result OH_Input_SetAxisEventAction(Input_AxisEvent* axisEvent, InputEvent_AxisAction action) 2053``` 2054 2055**Description** 2056 2057Sets the action for an axis event. 2058 2059**System capability**: SystemCapability.MultimodalInput.Input.Core 2060 2061**Since**: 12 2062 2063 2064**Parameters** 2065 2066| Parameter| Description| 2067| -- | -- | 2068| [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2069| [InputEvent_AxisAction](capi-oh-axis-type-h.md#inputevent_axisaction) action | Axis event action. For details, see [InputEvent_AxisAction](capi-oh-axis-type-h.md#inputevent_axisaction).| 2070 2071**Return value** 2072 2073| Type| Description| 2074| -- | -- | 2075| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** is null.| 2076 2077### OH_Input_GetAxisEventAction() 2078 2079``` 2080Input_Result OH_Input_GetAxisEventAction(const Input_AxisEvent* axisEvent, InputEvent_AxisAction *action) 2081``` 2082 2083**Description** 2084 2085Obtains the action of an axis event. 2086 2087**System capability**: SystemCapability.MultimodalInput.Input.Core 2088 2089**Since**: 12 2090 2091 2092**Parameters** 2093 2094| Parameter| Description| 2095| -- | -- | 2096| const [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2097| [InputEvent_AxisAction](capi-oh-axis-type-h.md#inputevent_axisaction) *action | Axis event action. For details, see [InputEvent_AxisAction](capi-oh-axis-type-h.md#inputevent_axisaction).| 2098 2099**Return value** 2100 2101| Type| Description| 2102| -- | -- | 2103| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** or **action** is null.| 2104 2105### OH_Input_SetAxisEventDisplayX() 2106 2107``` 2108Input_Result OH_Input_SetAxisEventDisplayX(Input_AxisEvent* axisEvent, float displayX) 2109``` 2110 2111**Description** 2112 2113Sets the X coordinate of the axis event in the relative coordinate system with the upper-left corner of the specified screen as the origin. 2114 2115**System capability**: SystemCapability.MultimodalInput.Input.Core 2116 2117**Since**: 12 2118 2119 2120**Parameters** 2121 2122| Parameter| Description| 2123| -- | -- | 2124| [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2125| float displayX | X coordinate of the axis event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 2126 2127**Return value** 2128 2129| Type| Description| 2130| -- | -- | 2131| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** is null.| 2132 2133### OH_Input_GetAxisEventDisplayX() 2134 2135``` 2136Input_Result OH_Input_GetAxisEventDisplayX(const Input_AxisEvent* axisEvent, float* displayX) 2137``` 2138 2139**Description** 2140 2141Obtains the X coordinate of the axis event in the relative coordinate system with the upper-left corner of the specified screen as the origin. 2142 2143**System capability**: SystemCapability.MultimodalInput.Input.Core 2144 2145**Since**: 12 2146 2147 2148**Parameters** 2149 2150| Parameter| Description| 2151| -- | -- | 2152| const [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2153| float* displayX | X coordinate of the axis event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 2154 2155**Return value** 2156 2157| Type| Description| 2158| -- | -- | 2159| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** or **displayX** is null.| 2160 2161### OH_Input_SetAxisEventDisplayY() 2162 2163``` 2164Input_Result OH_Input_SetAxisEventDisplayY(Input_AxisEvent* axisEvent, float displayY) 2165``` 2166 2167**Description** 2168 2169Sets the Y coordinate of the axis event in the relative coordinate system with the upper-left corner of the specified screen as the origin. 2170 2171**System capability**: SystemCapability.MultimodalInput.Input.Core 2172 2173**Since**: 12 2174 2175 2176**Parameters** 2177 2178| Parameter| Description| 2179| -- | -- | 2180| [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2181| float displayY | Y coordinate of the axis event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 2182 2183**Return value** 2184 2185| Type| Description| 2186| -- | -- | 2187| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** is null.| 2188 2189### OH_Input_GetAxisEventDisplayY() 2190 2191``` 2192Input_Result OH_Input_GetAxisEventDisplayY(const Input_AxisEvent* axisEvent, float* displayY) 2193``` 2194 2195**Description** 2196 2197Obtains the Y coordinate of the axis event in the relative coordinate system with the upper-left corner of the specified screen as the origin. 2198 2199**System capability**: SystemCapability.MultimodalInput.Input.Core 2200 2201**Since**: 12 2202 2203 2204**Parameters** 2205 2206| Parameter| Description| 2207| -- | -- | 2208| const [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2209| float* displayY | Y coordinate of the axis event in the relative coordinate system with the upper-left corner of the specified screen as the origin.| 2210 2211**Return value** 2212 2213| Type| Description| 2214| -- | -- | 2215| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** or **displayX** is null.| 2216 2217### OH_Input_SetAxisEventAxisValue() 2218 2219``` 2220Input_Result OH_Input_SetAxisEventAxisValue(Input_AxisEvent* axisEvent,InputEvent_AxisType axisType, double axisValue) 2221``` 2222 2223**Description** 2224 2225Sets the axis value of the axis type specified by the axis event. 2226 2227**System capability**: SystemCapability.MultimodalInput.Input.Core 2228 2229**Since**: 12 2230 2231 2232**Parameters** 2233 2234| Parameter| Description| 2235| -- | -- | 2236| [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2237| [InputEvent_AxisType](capi-oh-axis-type-h.md#inputevent_axistype) axisType | Axis type. For details, see [InputEvent_AxisType](capi-oh-axis-type-h.md#inputevent_axistype).| 2238| double axisValue | Axis event value. A positive number means scrolling forward (for example, 1.0 equals one unit forward), and a negative number means scrolling backward (for example, -1.0 equals one unit backward).| 2239 2240**Return value** 2241 2242| Type| Description| 2243| -- | -- | 2244| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** is null.| 2245 2246### OH_Input_GetAxisEventAxisValue() 2247 2248``` 2249Input_Result OH_Input_GetAxisEventAxisValue(const Input_AxisEvent* axisEvent,InputEvent_AxisType axisType, double* axisValue) 2250``` 2251 2252**Description** 2253 2254Obtains the axis value for the specified axis type of the axis event. 2255 2256**System capability**: SystemCapability.MultimodalInput.Input.Core 2257 2258**Since**: 12 2259 2260 2261**Parameters** 2262 2263| Parameter| Description| 2264| -- | -- | 2265| const [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2266| [InputEvent_AxisType](capi-oh-axis-type-h.md#inputevent_axistype) axisType | Axis type. For details, see [InputEvent_AxisType](capi-oh-axis-type-h.md#inputevent_axistype).| 2267| double* axisValue | Axis event value. A positive number means scrolling forward (for example, 1.0 equals one unit forward), and a negative number means scrolling backward (for example, -1.0 equals one unit backward).| 2268 2269**Return value** 2270 2271| Type| Description| 2272| -- | -- | 2273| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** or **axisValue** is null.| 2274 2275### OH_Input_SetAxisEventActionTime() 2276 2277``` 2278Input_Result OH_Input_SetAxisEventActionTime(Input_AxisEvent* axisEvent, int64_t actionTime) 2279``` 2280 2281**Description** 2282 2283Sets the time when an axis event occurs. 2284 2285**System capability**: SystemCapability.MultimodalInput.Input.Core 2286 2287**Since**: 12 2288 2289 2290**Parameters** 2291 2292| Parameter| Description| 2293| -- | -- | 2294| [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2295| int64_t actionTime | Axis event timestamp, which is measured as the number of milliseconds that have elapsed since the Unix epoch.| 2296 2297**Return value** 2298 2299| Type| Description| 2300| -- | -- | 2301| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** is null.| 2302 2303### OH_Input_GetAxisEventActionTime() 2304 2305``` 2306Input_Result OH_Input_GetAxisEventActionTime(const Input_AxisEvent* axisEvent, int64_t* actionTime) 2307``` 2308 2309**Description** 2310 2311Obtains the time when an axis event occurs. 2312 2313**System capability**: SystemCapability.MultimodalInput.Input.Core 2314 2315**Since**: 12 2316 2317 2318**Parameters** 2319 2320| Parameter| Description| 2321| -- | -- | 2322| const [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2323| int64_t* actionTime | Axis event timestamp, which is measured as the number of milliseconds that have elapsed since the Unix epoch.| 2324 2325**Return value** 2326 2327| Type| Description| 2328| -- | -- | 2329| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** or **actionTime** is null.| 2330 2331### OH_Input_SetAxisEventType() 2332 2333``` 2334Input_Result OH_Input_SetAxisEventType(Input_AxisEvent* axisEvent, InputEvent_AxisEventType axisEventType) 2335``` 2336 2337**Description** 2338 2339Sets the axis event type. 2340 2341**System capability**: SystemCapability.MultimodalInput.Input.Core 2342 2343**Since**: 12 2344 2345 2346**Parameters** 2347 2348| Parameter| Description| 2349| -- | -- | 2350| [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2351| [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype) axisEventType | Axis event type. For details, see [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype).| 2352 2353**Return value** 2354 2355| Type| Description| 2356| -- | -- | 2357| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** is null.| 2358 2359### OH_Input_GetAxisEventType() 2360 2361``` 2362Input_Result OH_Input_GetAxisEventType(const Input_AxisEvent* axisEvent, InputEvent_AxisEventType* axisEventType) 2363``` 2364 2365**Description** 2366 2367Obtains the axis event type. 2368 2369**System capability**: SystemCapability.MultimodalInput.Input.Core 2370 2371**Since**: 12 2372 2373 2374**Parameters** 2375 2376| Parameter| Description| 2377| -- | -- | 2378| const [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2379| [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype)* axisEventType | Axis event type. For details, see [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype).| 2380 2381**Return value** 2382 2383| Type| Description| 2384| -- | -- | 2385| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** or **axisEventType** is null.| 2386 2387### OH_Input_SetAxisEventSourceType() 2388 2389``` 2390Input_Result OH_Input_SetAxisEventSourceType(Input_AxisEvent* axisEvent, InputEvent_SourceType sourceType) 2391``` 2392 2393**Description** 2394 2395Sets the axis event source type. 2396 2397**System capability**: SystemCapability.MultimodalInput.Input.Core 2398 2399**Since**: 12 2400 2401 2402**Parameters** 2403 2404| Parameter| Description| 2405| -- | -- | 2406| [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2407| [InputEvent_SourceType](#inputevent_sourcetype) sourceType | Axis event source type. For details, see [InputEvent_SourceType](#inputevent_sourcetype).| 2408 2409**Return value** 2410 2411| Type| Description| 2412| -- | -- | 2413| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** is null.| 2414 2415### OH_Input_GetAxisEventSourceType() 2416 2417``` 2418Input_Result OH_Input_GetAxisEventSourceType(const Input_AxisEvent* axisEvent, InputEvent_SourceType* sourceType) 2419``` 2420 2421**Description** 2422 2423Obtains the axis event source type. 2424 2425**System capability**: SystemCapability.MultimodalInput.Input.Core 2426 2427**Since**: 12 2428 2429 2430**Parameters** 2431 2432| Parameter| Description| 2433| -- | -- | 2434| const [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2435| [InputEvent_SourceType](#inputevent_sourcetype)* sourceType | Axis event source type. For details, see [InputEvent_SourceType](#inputevent_sourcetype).| 2436 2437**Return value** 2438 2439| Type| Description| 2440| -- | -- | 2441| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** or **sourceType** is null.| 2442 2443### OH_Input_SetAxisEventWindowId() 2444 2445``` 2446Input_Result OH_Input_SetAxisEventWindowId(Input_AxisEvent* axisEvent, int32_t windowId) 2447``` 2448 2449**Description** 2450 2451Sets the window ID of an axis event. 2452 2453**System capability**: SystemCapability.MultimodalInput.Input.Core 2454 2455**Since**: 15 2456 2457 2458**Parameters** 2459 2460| Parameter| Description| 2461| -- | -- | 2462| [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2463| int32_t windowId | Window ID of the axis event.| 2464 2465**Return value** 2466 2467| Type| Description| 2468| -- | -- | 2469| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** is null.| 2470 2471### OH_Input_GetAxisEventWindowId() 2472 2473``` 2474Input_Result OH_Input_GetAxisEventWindowId(const Input_AxisEvent* axisEvent, int32_t* windowId) 2475``` 2476 2477**Description** 2478 2479Obtains the window ID of an axis event. 2480 2481**System capability**: SystemCapability.MultimodalInput.Input.Core 2482 2483**Since**: 15 2484 2485 2486**Parameters** 2487 2488| Parameter| Description| 2489| -- | -- | 2490| const [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2491| int32_t* windowId | Window ID of the axis event.| 2492 2493**Return value** 2494 2495| Type| Description| 2496| -- | -- | 2497| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** or **windowId** is null.| 2498 2499### OH_Input_SetAxisEventDisplayId() 2500 2501``` 2502Input_Result OH_Input_SetAxisEventDisplayId(Input_AxisEvent* axisEvent, int32_t displayId) 2503``` 2504 2505**Description** 2506 2507Sets the screen ID of an axis event. 2508 2509**System capability**: SystemCapability.MultimodalInput.Input.Core 2510 2511**Since**: 15 2512 2513 2514**Parameters** 2515 2516| Parameter| Description| 2517| -- | -- | 2518| [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2519| int32_t displayId | Screen ID of the axis event.| 2520 2521**Return value** 2522 2523| Type| Description| 2524| -- | -- | 2525| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** is null.| 2526 2527### OH_Input_GetAxisEventDisplayId() 2528 2529``` 2530Input_Result OH_Input_GetAxisEventDisplayId(const Input_AxisEvent* axisEvent, int32_t* displayId) 2531``` 2532 2533**Description** 2534 2535Obtains the screen ID of an axis event. 2536 2537**System capability**: SystemCapability.MultimodalInput.Input.Core 2538 2539**Since**: 15 2540 2541 2542**Parameters** 2543 2544| Parameter| Description| 2545| -- | -- | 2546| const [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 2547| int32_t* displayId | Screen ID of the axis event.| 2548 2549**Return value** 2550 2551| Type| Description| 2552| -- | -- | 2553| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** or **displayId** is null.| 2554 2555### OH_Input_AddKeyEventMonitor() 2556 2557``` 2558Input_Result OH_Input_AddKeyEventMonitor(Input_KeyEventCallback callback) 2559``` 2560 2561**Description** 2562 2563Adds a listener for key events. 2564 2565**System capability**: SystemCapability.MultimodalInput.Input.Core 2566 2567**Required permissions**: ohos.permission.INPUT_MONITORING 2568 2569**Since**: 12 2570 2571 2572**Parameters** 2573 2574| Parameter| Description| 2575| -- | -- | 2576| [Input_KeyEventCallback](#input_keyeventcallback) callback | Callback used to receive key events.| 2577 2578**Return value** 2579 2580| Type| Description| 2581| -- | -- | 2582| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;<br> [INPUT_PARAMETER_ERROR](#input_result) if the callback is empty; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 2583 2584### OH_Input_AddMouseEventMonitor() 2585 2586``` 2587Input_Result OH_Input_AddMouseEventMonitor(Input_MouseEventCallback callback) 2588``` 2589 2590**Description** 2591 2592Adds a listener for mouse events, including mouse click and movement events, but not scroll wheel events. Scroll wheel events are axis events. 2593 2594**System capability**: SystemCapability.MultimodalInput.Input.Core 2595 2596**Required permissions**: ohos.permission.INPUT_MONITORING 2597 2598**Since**: 12 2599 2600 2601**Parameters** 2602 2603| Parameter| Description| 2604| -- | -- | 2605| [Input_MouseEventCallback](#input_mouseeventcallback) callback | Callback used to receive mouse events.| 2606 2607**Return value** 2608 2609| Type| Description| 2610| -- | -- | 2611| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;<br> [INPUT_PARAMETER_ERROR](#input_result) if the callback is empty; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 2612 2613### OH_Input_AddTouchEventMonitor() 2614 2615``` 2616Input_Result OH_Input_AddTouchEventMonitor(Input_TouchEventCallback callback) 2617``` 2618 2619**Description** 2620 2621Adds a listener for touch events. 2622 2623**System capability**: SystemCapability.MultimodalInput.Input.Core 2624 2625**Required permissions**: ohos.permission.INPUT_MONITORING 2626 2627**Since**: 12 2628 2629 2630**Parameters** 2631 2632| Parameter| Description| 2633| -- | -- | 2634| [Input_TouchEventCallback](#input_toucheventcallback) callback | Callback used to receive touch events.| 2635 2636**Return value** 2637 2638| Type| Description| 2639| -- | -- | 2640| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;<br> [INPUT_PARAMETER_ERROR](#input_result) if the callback is empty; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 2641 2642### OH_Input_AddAxisEventMonitorForAll() 2643 2644``` 2645Input_Result OH_Input_AddAxisEventMonitorForAll(Input_AxisEventCallback callback) 2646``` 2647 2648**Description** 2649 2650Adds a listener for all types of axis events, which are defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype). 2651 2652**System capability**: SystemCapability.MultimodalInput.Input.Core 2653 2654**Required permissions**: ohos.permission.INPUT_MONITORING 2655 2656**Since**: 12 2657 2658 2659**Parameters** 2660 2661| Parameter| Description| 2662| -- | -- | 2663| [Input_AxisEventCallback](#input_axiseventcallback) callback | Callback used to receive axis events.| 2664 2665**Return value** 2666 2667| Type| Description| 2668| -- | -- | 2669| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;<br> [INPUT_PARAMETER_ERROR](#input_result) if the callback is empty; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 2670 2671### OH_Input_AddAxisEventMonitor() 2672 2673``` 2674Input_Result OH_Input_AddAxisEventMonitor(InputEvent_AxisEventType axisEventType, Input_AxisEventCallback callback) 2675``` 2676 2677**Description** 2678 2679Adds a listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype). 2680 2681**System capability**: SystemCapability.MultimodalInput.Input.Core 2682 2683**Required permissions**: ohos.permission.INPUT_MONITORING 2684 2685**Since**: 12 2686 2687 2688**Parameters** 2689 2690| Parameter| Description| 2691| -- | -- | 2692| [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype) axisEventType | Axis event type, which is defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype).| 2693| [Input_AxisEventCallback](#input_axiseventcallback) callback | Callback used to receive the specified type of axis events.| 2694 2695**Return value** 2696 2697| Type| Description| 2698| -- | -- | 2699| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;<br> [INPUT_PARAMETER_ERROR](#input_result) if the callback is empty; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 2700 2701### OH_Input_RemoveKeyEventMonitor() 2702 2703``` 2704Input_Result OH_Input_RemoveKeyEventMonitor(Input_KeyEventCallback callback) 2705``` 2706 2707**Description** 2708 2709Removes the listener for key events. 2710 2711**System capability**: SystemCapability.MultimodalInput.Input.Core 2712 2713**Required permissions**: ohos.permission.INPUT_MONITORING 2714 2715**Since**: 12 2716 2717 2718**Parameters** 2719 2720| Parameter| Description| 2721| -- | -- | 2722| [Input_KeyEventCallback](#input_keyeventcallback) callback | Callback for key events.| 2723 2724**Return value** 2725 2726| Type| Description| 2727| -- | -- | 2728| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;<br> [INPUT_PARAMETER_ERROR](#input_result) if the callback is empty or no listener is added; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 2729 2730### OH_Input_RemoveMouseEventMonitor() 2731 2732``` 2733Input_Result OH_Input_RemoveMouseEventMonitor(Input_MouseEventCallback callback) 2734``` 2735 2736**Description** 2737 2738Removes the listener for mouse events. 2739 2740**System capability**: SystemCapability.MultimodalInput.Input.Core 2741 2742**Required permissions**: ohos.permission.INPUT_MONITORING 2743 2744**Since**: 12 2745 2746 2747**Parameters** 2748 2749| Parameter| Description| 2750| -- | -- | 2751| [Input_MouseEventCallback](#input_mouseeventcallback) callback | Callback for mouse events.| 2752 2753**Return value** 2754 2755| Type| Description| 2756| -- | -- | 2757| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;<br> [INPUT_PARAMETER_ERROR](#input_result) if the callback is empty or no listener is added; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 2758 2759### OH_Input_RemoveTouchEventMonitor() 2760 2761``` 2762Input_Result OH_Input_RemoveTouchEventMonitor(Input_TouchEventCallback callback) 2763``` 2764 2765**Description** 2766 2767Removes the listener for touch events. 2768 2769**System capability**: SystemCapability.MultimodalInput.Input.Core 2770 2771**Required permissions**: ohos.permission.INPUT_MONITORING 2772 2773**Since**: 12 2774 2775 2776**Parameters** 2777 2778| Parameter| Description| 2779| -- | -- | 2780| [Input_TouchEventCallback](#input_toucheventcallback) callback | Callback for touch events.| 2781 2782**Return value** 2783 2784| Type| Description| 2785| -- | -- | 2786| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;<br> [INPUT_PARAMETER_ERROR](#input_result) if the callback is empty or no listener is added; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 2787 2788### OH_Input_RemoveAxisEventMonitorForAll() 2789 2790``` 2791Input_Result OH_Input_RemoveAxisEventMonitorForAll(Input_AxisEventCallback callback) 2792``` 2793 2794**Description** 2795 2796Removes the listener for all types of axis events. 2797 2798**System capability**: SystemCapability.MultimodalInput.Input.Core 2799 2800**Required permissions**: ohos.permission.INPUT_MONITORING 2801 2802**Since**: 12 2803 2804 2805**Parameters** 2806 2807| Parameter| Description| 2808| -- | -- | 2809| [Input_AxisEventCallback](#input_axiseventcallback) callback | Callback for the all types of axis events.| 2810 2811**Return value** 2812 2813| Type| Description| 2814| -- | -- | 2815| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;<br> [INPUT_PARAMETER_ERROR](#input_result) if the callback is empty or no listener is added; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 2816 2817### OH_Input_RemoveAxisEventMonitor() 2818 2819``` 2820Input_Result OH_Input_RemoveAxisEventMonitor(InputEvent_AxisEventType axisEventType, Input_AxisEventCallback callback) 2821``` 2822 2823**Description** 2824 2825Removes the listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype). 2826 2827**System capability**: SystemCapability.MultimodalInput.Input.Core 2828 2829**Required permissions**: ohos.permission.INPUT_MONITORING 2830 2831**Since**: 12 2832 2833 2834**Parameters** 2835 2836| Parameter| Description| 2837| -- | -- | 2838| [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype) axisEventType | Axis event type, which is defined in [InputEvent_AxisEventType](capi-oh-axis-type-h.md#inputevent_axiseventtype).| 2839| [Input_AxisEventCallback](#input_axiseventcallback) callback | Callback for the specified type of axis events.| 2840 2841**Return value** 2842 2843| Type| Description| 2844| -- | -- | 2845| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;<br> [INPUT_PARAMETER_ERROR](#input_result) if the callback is empty or no listener is added; [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 2846 2847### OH_Input_AddKeyEventInterceptor() 2848 2849``` 2850Input_Result OH_Input_AddKeyEventInterceptor(Input_KeyEventCallback callback, Input_InterceptorOptions *option) 2851``` 2852 2853**Description** 2854 2855Adds an interceptor for key events. If multiple interceptors are added, only the first one takes effect. Key events are intercepted only when the application gains focus. 2856 2857**System capability**: SystemCapability.MultimodalInput.Input.Core 2858 2859**Required permission**: ohos.permission.INTERCEPT_INPUT_EVENT 2860 2861**Since**: 12 2862 2863 2864**Parameters** 2865 2866| Parameter| Description| 2867| -- | -- | 2868| [Input_KeyEventCallback](#input_keyeventcallback) callback | Callback used to receive key events.| 2869| [Input_InterceptorOptions](capi-input-input-interceptoroptions.md) *option | Options for event interception. If **null** is passed, the default value is used.| 2870 2871**Return value** 2872 2873| Type| Description| 2874| -- | -- | 2875| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;<br> [INPUT_PARAMETER_ERROR](#input_result) if the callback is empty or no listener is added; [INPUT_REPEAT_INTERCEPTOR](#input_result) if an interceptor is repeatedly added;<br> [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 2876 2877### OH_Input_AddInputEventInterceptor() 2878 2879``` 2880Input_Result OH_Input_AddInputEventInterceptor(Input_InterceptorEventCallback *callback,Input_InterceptorOptions *option) 2881``` 2882 2883**Description** 2884 2885Adds an interceptor for input events, including mouse, touch, and axis events. If multiple interceptors are added, only the first one takes effect. Key events are intercepted only when the application window is hit. 2886 2887**System capability**: SystemCapability.MultimodalInput.Input.Core 2888 2889**Required permission**: ohos.permission.INTERCEPT_INPUT_EVENT 2890 2891**Since**: 12 2892 2893 2894**Parameters** 2895 2896| Parameter| Description| 2897| -- | -- | 2898| [Input_InterceptorEventCallback](capi-input-input-interceptoreventcallback.md) *callback | Pointer to the structure of the interceptor event callback. For details, see [Input_InterceptorEventCallback](capi-input-input-interceptoreventcallback.md).| 2899| [Input_InterceptorOptions](capi-input-input-interceptoroptions.md) *option | Options for event interception. If **null** is passed, the default value is used.| 2900 2901**Return value** 2902 2903| Type| Description| 2904| -- | -- | 2905| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;<br> [INPUT_PARAMETER_ERROR](#input_result) if the callback is empty or no listener is added; [INPUT_REPEAT_INTERCEPTOR](#input_result) if an interceptor is repeatedly added;<br> [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 2906 2907### OH_Input_RemoveKeyEventInterceptor() 2908 2909``` 2910Input_Result OH_Input_RemoveKeyEventInterceptor(void) 2911``` 2912 2913**Description** 2914 2915Removes the interceptor for key events. 2916 2917**System capability**: SystemCapability.MultimodalInput.Input.Core 2918 2919**Required permission**: ohos.permission.INTERCEPT_INPUT_EVENT 2920 2921**Since**: 12 2922 2923**Return value** 2924 2925| Type| Description| 2926| -- | -- | 2927| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;<br> [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 2928 2929### OH_Input_RemoveInputEventInterceptor() 2930 2931``` 2932Input_Result OH_Input_RemoveInputEventInterceptor(void) 2933``` 2934 2935**Description** 2936 2937Removes the interceptor for input events, including mouse, touch, and axis events. 2938 2939**System capability**: SystemCapability.MultimodalInput.Input.Core 2940 2941**Required permission**: ohos.permission.INTERCEPT_INPUT_EVENT 2942 2943**Since**: 12 2944 2945**Return value** 2946 2947| Type| Description| 2948| -- | -- | 2949| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PERMISSION_DENIED](#input_result) if permission verification fails;<br> [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 2950 2951### OH_Input_GetIntervalSinceLastInput() 2952 2953``` 2954Input_Result OH_Input_GetIntervalSinceLastInput(int64_t *timeInterval) 2955``` 2956 2957**Description** 2958 2959Obtains the interval since the last system input event. 2960 2961**System capability**: SystemCapability.MultimodalInput.Input.Core 2962 2963**Since**: 14 2964 2965 2966**Parameters** 2967 2968| Parameter| Description| 2969| -- | -- | 2970| int64_t *timeInterval | Interval, in microseconds.| 2971 2972**Return value** 2973 2974| Type| Description| 2975| -- | -- | 2976| [Input_Result](#input_result) | Status code of the **OH_Input_GetIntervalSinceLastInput** function,<br> [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_SERVICE_EXCEPTION](#input_result) otherwise.| 2977 2978### OH_Input_CreateHotkey() 2979 2980``` 2981Input_Hotkey *OH_Input_CreateHotkey(void) 2982``` 2983 2984**Description** 2985 2986Creates a shortcut key object. 2987 2988**System capability**: SystemCapability.MultimodalInput.Input.Core 2989 2990**Since**: 14 2991 2992**Return value** 2993 2994| Type| Description| 2995| -- | -- | 2996| [Input_Hotkey](capi-input-input-hotkey.md) | [Input_Hotkey](capi-input-input-hotkey.md) pointer if the operation is successful; a null pointer otherwise (possibly because of a memory allocation failure).| 2997 2998### OH_Input_DestroyHotkey() 2999 3000``` 3001void OH_Input_DestroyHotkey(Input_Hotkey **hotkey) 3002``` 3003 3004**Description** 3005 3006Destroys a shortcut key object. 3007 3008**System capability**: SystemCapability.MultimodalInput.Input.Core 3009 3010**Since**: 14 3011 3012 3013**Parameters** 3014 3015| Parameter| Description| 3016| -- | -- | 3017| [Input_Hotkey](capi-input-input-hotkey.md) **hotkey | Shortcut key object.| 3018 3019### OH_Input_SetPreKeys() 3020 3021``` 3022void OH_Input_SetPreKeys(Input_Hotkey *hotkey, int32_t *preKeys, int32_t size) 3023``` 3024 3025**Description** 3026 3027Sets the modifier keys. 3028 3029**System capability**: SystemCapability.MultimodalInput.Input.Core 3030 3031**Since**: 14 3032 3033 3034**Parameters** 3035 3036| Parameter| Description| 3037| -- | -- | 3038| [Input_Hotkey](capi-input-input-hotkey.md) *hotkey | Shortcut key object.| 3039| int32_t *preKeys | List of modifier keys.| 3040| int32_t size | Number of modifier keys. One or two modifier keys are supported.| 3041 3042### OH_Input_GetPreKeys() 3043 3044``` 3045Input_Result OH_Input_GetPreKeys(const Input_Hotkey *hotkey, int32_t **preKeys, int32_t *preKeyCount) 3046``` 3047 3048**Description** 3049 3050Obtains the modifier key. 3051 3052**System capability**: SystemCapability.MultimodalInput.Input.Core 3053 3054**Since**: 14 3055 3056 3057**Parameters** 3058 3059| Parameter| Description| 3060| -- | -- | 3061| const [Input_Hotkey](capi-input-input-hotkey.md) *hotkey | Shortcut key object.| 3062| int32_t **preKeys | List of modifier keys.| 3063| int32_t *preKeyCount | Number of modifier keys.| 3064 3065**Return value** 3066 3067| Type| Description| 3068| -- | -- | 3069| [Input_Result](#input_result) | Error code of the **OH_Input_GetPreKeys** function.<br> [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) otherwise.| 3070 3071### OH_Input_SetFinalKey() 3072 3073``` 3074void OH_Input_SetFinalKey(Input_Hotkey* hotkey, int32_t finalKey) 3075``` 3076 3077**Description** 3078 3079Sets the modified key. 3080 3081**System capability**: SystemCapability.MultimodalInput.Input.Core 3082 3083**Since**: 14 3084 3085 3086**Parameters** 3087 3088| Parameter| Description| 3089| -- | -- | 3090| [Input_Hotkey](capi-input-input-hotkey.md)* hotkey | Shortcut key object.| 3091| int32_t finalKey | Modifier key value. Only one modifier key value is allowed.| 3092 3093### OH_Input_GetFinalKey() 3094 3095``` 3096Input_Result OH_Input_GetFinalKey(const Input_Hotkey* hotkey, int32_t *finalKeyCode) 3097``` 3098 3099**Description** 3100 3101Obtains the modified key. 3102 3103**System capability**: SystemCapability.MultimodalInput.Input.Core 3104 3105**Since**: 14 3106 3107 3108**Parameters** 3109 3110| Parameter| Description| 3111| -- | -- | 3112| const [Input_Hotkey](capi-input-input-hotkey.md)* hotkey | Shortcut key object.| 3113| int32_t *finalKeyCode | Modified key.| 3114 3115**Return value** 3116 3117| Type| Description| 3118| -- | -- | 3119| [Input_Result](#input_result) | Error code of the **OH_Input_GetFinalKey** function.<br> [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) otherwise.| 3120 3121### OH_Input_CreateAllSystemHotkeys() 3122 3123``` 3124Input_Hotkey **OH_Input_CreateAllSystemHotkeys(int32_t count) 3125``` 3126 3127**Description** 3128 3129Creates an [Input_Hotkey](capi-input-input-hotkey.md) array. 3130 3131**System capability**: SystemCapability.MultimodalInput.Input.Core 3132 3133**Since**: 14 3134 3135 3136**Parameters** 3137 3138| Parameter| Description| 3139| -- | -- | 3140| int32_t count | Number of [Input_Hotkey](capi-input-input-hotkey.md) instances.| 3141 3142**Return value** 3143 3144| Type| Description| 3145| -- | -- | 3146| [Input_Hotkey](capi-input-input-hotkey.md) | Error codes of the **OH_Input_CreateAllSystemHotkeys** function.<br> which is [INPUT_SUCCESS](#input_result) if the operation is successful.| 3147 3148### OH_Input_DestroyAllSystemHotkeys() 3149 3150``` 3151void OH_Input_DestroyAllSystemHotkeys(Input_Hotkey **hotkeys, int32_t count) 3152``` 3153 3154**Description** 3155 3156Destroys an [Input_Hotkey](capi-input-input-hotkey.md) array and reclaims the memory. 3157 3158**System capability**: SystemCapability.MultimodalInput.Input.Core 3159 3160**Since**: 14 3161 3162 3163**Parameters** 3164 3165| Parameter| Description| 3166| -- | -- | 3167| [Input_Hotkey](capi-input-input-hotkey.md) **hotkeys | Double pointer to the [Input_Hotkey](capi-input-input-hotkey.md) array.| 3168| int32_t count | Number of [Input_Hotkey](capi-input-input-hotkey.md) instances.| 3169 3170### OH_Input_GetAllSystemHotkeys() 3171 3172``` 3173Input_Result OH_Input_GetAllSystemHotkeys(Input_Hotkey **hotkey, int32_t *count) 3174``` 3175 3176**Description** 3177 3178Obtains all configured shortcut keys. 3179 3180**System capability**: SystemCapability.MultimodalInput.Input.Core 3181 3182**Since**: 14 3183 3184 3185**Parameters** 3186 3187| Parameter| Description| 3188| -- | -- | 3189| [Input_Hotkey](capi-input-input-hotkey.md) **hotkey | [Input_Hotkey](capi-input-input-hotkey.md) array. When calling this API for the first time, you can pass **NULL** to obtain the array length.| 3190| int32_t *count | Number of supported shortcut keys.| 3191 3192**Return value** 3193 3194| Type| Description| 3195| -- | -- | 3196| [Input_Result](#input_result) | Status code of the **OH_Input_GetAllSystemHotkeys** function, which is<br> [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) otherwise.| 3197 3198### OH_Input_SetRepeat() 3199 3200``` 3201void OH_Input_SetRepeat(Input_Hotkey* hotkey, bool isRepeat) 3202``` 3203 3204**Description** 3205 3206Specifies whether to report repeated key events. 3207 3208**System capability**: SystemCapability.MultimodalInput.Input.Core 3209 3210**Since**: 14 3211 3212 3213**Parameters** 3214 3215| Parameter| Description| 3216| -- | -- | 3217| [Input_Hotkey](capi-input-input-hotkey.md)* hotkey | Shortcut key object.| 3218| bool isRepeat | Whether to report repeated key events. The value **true** means to report repeated key events, and the value **false** means the opposite.| 3219 3220### OH_Input_GetRepeat() 3221 3222``` 3223Input_Result OH_Input_GetRepeat(const Input_Hotkey* hotkey, bool *isRepeat) 3224``` 3225 3226**Description** 3227 3228Checks whether to report repeated key events. 3229 3230**System capability**: SystemCapability.MultimodalInput.Input.Core 3231 3232**Since**: 14 3233 3234 3235**Parameters** 3236 3237| Parameter| Description| 3238| -- | -- | 3239| const [Input_Hotkey](capi-input-input-hotkey.md)* hotkey | Shortcut key object.| 3240| bool *isRepeat | Whether the reported key event is repeated.| 3241 3242**Return value** 3243 3244| Type| Description| 3245| -- | -- | 3246| [Input_Result](#input_result) | Error code of the **OH_Input_GetRepeat** function.<br> [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) otherwise.| 3247 3248### OH_Input_AddHotkeyMonitor() 3249 3250``` 3251Input_Result OH_Input_AddHotkeyMonitor(const Input_Hotkey* hotkey, Input_HotkeyCallback callback) 3252``` 3253 3254**Description** 3255 3256Subscribes to shortcut key events. This API is not applicable to wearables and lite wearables. 3257 3258**System capability**: SystemCapability.MultimodalInput.Input.Core 3259 3260**Since**: 14 3261 3262 3263**Parameters** 3264 3265| Parameter| Description| 3266| -- | -- | 3267| const [Input_Hotkey](capi-input-input-hotkey.md)* hotkey | Shortcut key object.| 3268| [Input_HotkeyCallback](#input_hotkeycallback) callback | Defines the callback used to return shortcut key events.| 3269 3270**Return value** 3271 3272| Type| Description| 3273| -- | -- | 3274| [Input_Result](#input_result) | OH_Input_AddHotkeyMonitor status code, specifically,<br> [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if parameter verification fails;<br> [INPUT_OCCUPIED_BY_SYSTEM](#input_result) if the shortcut key has been occupied by the system (you can use [OH_Input_GetAllSystemHotkeys](#oh_input_getallsystemhotkeys) to query allsystem shortcut keys);<br> [INPUT_OCCUPIED_BY_OTHER](#input_result) if the shortcut key has been occupied by another application;<br> [INPUT_DEVICE_NOT_SUPPORTED](#input_result) if the function is not supported.| 3275 3276### OH_Input_RemoveHotkeyMonitor() 3277 3278``` 3279Input_Result OH_Input_RemoveHotkeyMonitor(const Input_Hotkey* hotkey, Input_HotkeyCallback callback) 3280``` 3281 3282**Description** 3283 3284Unsubscribes from shortcut key events. 3285 3286**System capability**: SystemCapability.MultimodalInput.Input.Core 3287 3288**Since**: 14 3289 3290 3291**Parameters** 3292 3293| Parameter| Description| 3294| -- | -- | 3295| const [Input_Hotkey](capi-input-input-hotkey.md)* hotkey | Shortcut key object.| 3296| [Input_HotkeyCallback](#input_hotkeycallback) callback | Defines the callback used to return shortcut key events.| 3297 3298**Return value** 3299 3300| Type| Description| 3301| -- | -- | 3302| [Input_Result](#input_result) | OH_Input_RemoveHotkeyMonitor status code, specifically,<br> [INPUT_SUCCESS](#input_result) if the operation is successful; [INPUT_PARAMETER_ERROR](#input_result) if parameter verification fails.| 3303 3304### OH_Input_RegisterDeviceListener() 3305 3306``` 3307Input_Result OH_Input_RegisterDeviceListener(Input_DeviceListener* listener) 3308``` 3309 3310**Description** 3311 3312Registers a listener for device hot swap events. 3313 3314**System capability**: SystemCapability.MultimodalInput.Input.Core 3315 3316**Since**: 13 3317 3318 3319**Parameters** 3320 3321| Parameter| Description| 3322| -- | -- | 3323| [Input_DeviceListener](capi-input-input-devicelistener.md)* listener | Pointer to the [Input_DeviceListener](capi-input-input-devicelistener.md) object.| 3324 3325**Return value** 3326 3327| Type| Description| 3328| -- | -- | 3329| [Input_Result](#input_result) | **OH_Input_RegisterDeviceListener** status code, specifically:<br> [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if the listener is null.| 3330 3331### OH_Input_UnregisterDeviceListener() 3332 3333``` 3334Input_Result OH_Input_UnregisterDeviceListener(Input_DeviceListener* listener) 3335``` 3336 3337**Description** 3338 3339Unregisters the listener for device hot swap events. 3340 3341**System capability**: SystemCapability.MultimodalInput.Input.Core 3342 3343**Since**: 13 3344 3345 3346**Parameters** 3347 3348| Parameter| Description| 3349| -- | -- | 3350| [Input_DeviceListener](capi-input-input-devicelistener.md)* listener | Pointer to the [Input_DeviceListener](capi-input-input-devicelistener.md) object.| 3351 3352**Return value** 3353 3354| Type| Description| 3355| -- | -- | 3356| [Input_Result](#input_result) | **OH_Input_UnregisterDeviceListener** status code, specifically:<br> [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if **listener** is null or the listener is not registered;<br> [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 3357 3358### OH_Input_UnregisterDeviceListeners() 3359 3360``` 3361Input_Result OH_Input_UnregisterDeviceListeners() 3362``` 3363 3364**Description** 3365 3366Unregisters the listener for all device hot swap events. 3367 3368**System capability**: SystemCapability.MultimodalInput.Input.Core 3369 3370**Since**: 13 3371 3372**Return value** 3373 3374| Type| Description| 3375| -- | -- | 3376| [Input_Result](#input_result) | **OH_Input_UnregisterDeviceListener** status code, specifically:<br> [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_SERVICE_EXCEPTION](#input_result) if the service is abnormal.| 3377 3378### OH_Input_GetDeviceIds() 3379 3380``` 3381Input_Result OH_Input_GetDeviceIds(int32_t *deviceIds, int32_t inSize, int32_t *outSize) 3382``` 3383 3384**Description** 3385 3386Obtains the IDs of all input devices. 3387 3388**System capability**: SystemCapability.MultimodalInput.Input.Core 3389 3390**Since**: 13 3391 3392 3393**Parameters** 3394 3395| Parameter| Description| 3396| -- | -- | 3397| int32_t *deviceIds | List of input device IDs.| 3398| int32_t inSize | Size of the input device ID list.| 3399| int32_t *outSize | Length of the input device ID list. The value must be less than or equal to the value of **inSize**.| 3400 3401**Return value** 3402 3403| Type| Description| 3404| -- | -- | 3405| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if **deviceIds** or **outSize** is a null pointer or **inSize** is less than **0**.| 3406 3407### OH_Input_GetDevice() 3408 3409``` 3410Input_Result OH_Input_GetDevice(int32_t deviceId, Input_DeviceInfo **deviceInfo) 3411``` 3412 3413**Description** 3414 3415Obtains information about the input device. 3416 3417**System capability**: SystemCapability.MultimodalInput.Input.Core 3418 3419**Since**: 13 3420 3421 3422**Parameters** 3423 3424| Parameter| Description| 3425| -- | -- | 3426| int32_t deviceId | Device ID.| 3427| [Input_DeviceInfo](capi-input-input-deviceinfo.md) **deviceInfo | Pointer to the [Input_DeviceInfo](capi-input-input-deviceinfo.md) object.| 3428 3429**Return value** 3430 3431| Type| Description| 3432| -- | -- | 3433| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** is a null pointer or **deviceId** is invalid.<br> You can use [OH_Input_GetDeviceIds](#oh_input_getdeviceids) to query the device IDs supported by the system.| 3434 3435### OH_Input_CreateDeviceInfo() 3436 3437``` 3438Input_DeviceInfo* OH_Input_CreateDeviceInfo(void) 3439``` 3440 3441**Description** 3442 3443Creates a **deviceInfo** object. 3444 3445**System capability**: SystemCapability.MultimodalInput.Input.Core 3446 3447**Since**: 13 3448 3449**Return value** 3450 3451| Type| Description| 3452| -- | -- | 3453| Input_DeviceInfo* | Pointer to the [Input_DeviceInfo](capi-input-input-deviceinfo.md) object if the operation is successful; a null pointer otherwise (possibly because of a memory allocation failure).| 3454 3455### OH_Input_DestroyDeviceInfo() 3456 3457``` 3458void OH_Input_DestroyDeviceInfo(Input_DeviceInfo **deviceInfo) 3459``` 3460 3461**Description** 3462 3463Destroys a **deviceInfo** object. 3464 3465**System capability**: SystemCapability.MultimodalInput.Input.Core 3466 3467**Since**: 13 3468 3469 3470**Parameters** 3471 3472| Parameter| Description| 3473| -- | -- | 3474| [Input_DeviceInfo](capi-input-input-deviceinfo.md) **deviceInfo | **deviceInfo** object.| 3475 3476### OH_Input_GetKeyboardType() 3477 3478``` 3479Input_Result OH_Input_GetKeyboardType(int32_t deviceId, int32_t *keyboardType) 3480``` 3481 3482**Description** 3483 3484Obtains the keyboard type of an input device. 3485 3486**System capability**: SystemCapability.MultimodalInput.Input.Core 3487 3488**Since**: 13 3489 3490 3491**Parameters** 3492 3493| Parameter| Description| 3494| -- | -- | 3495| int32_t deviceId | Device ID.| 3496| int32_t *keyboardType | Pointer to the keyboard type of the input device.| 3497 3498**Return value** 3499 3500| Type| Description| 3501| -- | -- | 3502| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if the device ID is invalid or **keyboardType** is a null pointer.| 3503 3504### OH_Input_GetDeviceId() 3505 3506``` 3507Input_Result OH_Input_GetDeviceId(Input_DeviceInfo *deviceInfo, int32_t *id) 3508``` 3509 3510**Description** 3511 3512Obtains the ID of an input device. 3513 3514**System capability**: SystemCapability.MultimodalInput.Input.Core 3515 3516**Since**: 13 3517 3518 3519**Parameters** 3520 3521| Parameter| Description| 3522| -- | -- | 3523| [Input_DeviceInfo](capi-input-input-deviceinfo.md) *deviceInfo | Input device information. For details, see [Input_DeviceInfo](capi-input-input-deviceinfo.md).| 3524| int32_t *id | Pointer to the input device ID.| 3525 3526**Return value** 3527 3528| Type| Description| 3529| -- | -- | 3530| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** or **id** is a null pointer.| 3531 3532### OH_Input_GetDeviceName() 3533 3534``` 3535Input_Result OH_Input_GetDeviceName(Input_DeviceInfo *deviceInfo, char **name) 3536``` 3537 3538**Description** 3539 3540Obtains the name of an input device. 3541 3542**System capability**: SystemCapability.MultimodalInput.Input.Core 3543 3544**Since**: 13 3545 3546 3547**Parameters** 3548 3549| Parameter| Description| 3550| -- | -- | 3551| [Input_DeviceInfo](capi-input-input-deviceinfo.md) *deviceInfo | Input device information. For details, see [Input_DeviceInfo](capi-input-input-deviceinfo.md).| 3552| char **name | Pointer to the input device name.| 3553 3554**Return value** 3555 3556| Type| Description| 3557| -- | -- | 3558| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** or **name** is a null pointer.| 3559 3560### OH_Input_GetCapabilities() 3561 3562``` 3563Input_Result OH_Input_GetCapabilities(Input_DeviceInfo *deviceInfo, int32_t *capabilities) 3564``` 3565 3566**Description** 3567 3568Obtains the capabilities of an input device, for example, a touchscreen, touchpad, or keyboard. 3569 3570**System capability**: SystemCapability.MultimodalInput.Input.Core 3571 3572**Since**: 13 3573 3574 3575**Parameters** 3576 3577| Parameter| Description| 3578| -- | -- | 3579| [Input_DeviceInfo](capi-input-input-deviceinfo.md) *deviceInfo | Input device information. For details, see [Input_DeviceInfo](capi-input-input-deviceinfo.md).| 3580| int32_t *capabilities | Pointer to the capability information of the input device.| 3581 3582**Return value** 3583 3584| Type| Description| 3585| -- | -- | 3586| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** or **capabilities** is a null pointer.| 3587 3588### OH_Input_GetDeviceVersion() 3589 3590``` 3591Input_Result OH_Input_GetDeviceVersion(Input_DeviceInfo *deviceInfo, int32_t *version) 3592``` 3593 3594**Description** 3595 3596Obtains the version information of an input device. 3597 3598**System capability**: SystemCapability.MultimodalInput.Input.Core 3599 3600**Since**: 13 3601 3602 3603**Parameters** 3604 3605| Parameter| Description| 3606| -- | -- | 3607| [Input_DeviceInfo](capi-input-input-deviceinfo.md) *deviceInfo | Input device information. For details, see [Input_DeviceInfo](capi-input-input-deviceinfo.md).| 3608| int32_t *version | Pointer to the version information of the input device.| 3609 3610**Return value** 3611 3612| Type| Description| 3613| -- | -- | 3614| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** or **version** is a null pointer.| 3615 3616### OH_Input_GetDeviceProduct() 3617 3618``` 3619Input_Result OH_Input_GetDeviceProduct(Input_DeviceInfo *deviceInfo, int32_t *product) 3620``` 3621 3622**Description** 3623 3624Obtains the product information of an input device. 3625 3626**System capability**: SystemCapability.MultimodalInput.Input.Core 3627 3628**Since**: 13 3629 3630 3631**Parameters** 3632 3633| Parameter| Description| 3634| -- | -- | 3635| [Input_DeviceInfo](capi-input-input-deviceinfo.md) *deviceInfo | Input device information. For details, see [Input_DeviceInfo](capi-input-input-deviceinfo.md).| 3636| int32_t *product | Pointer to the product information of the input device.| 3637 3638**Return value** 3639 3640| Type| Description| 3641| -- | -- | 3642| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** or **product** is a null pointer.| 3643 3644### OH_Input_GetDeviceVendor() 3645 3646``` 3647Input_Result OH_Input_GetDeviceVendor(Input_DeviceInfo *deviceInfo, int32_t *vendor) 3648``` 3649 3650**Description** 3651 3652Obtains the vendor information of an input device. 3653 3654**System capability**: SystemCapability.MultimodalInput.Input.Core 3655 3656**Since**: 13 3657 3658 3659**Parameters** 3660 3661| Parameter| Description| 3662| -- | -- | 3663| [Input_DeviceInfo](capi-input-input-deviceinfo.md) *deviceInfo | Input device information. For details, see [Input_DeviceInfo](capi-input-input-deviceinfo.md).| 3664| int32_t *vendor | Pointer to the vendor information of the input device.| 3665 3666**Return value** 3667 3668| Type| Description| 3669| -- | -- | 3670| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** or **vendor** is a null pointer.| 3671 3672### OH_Input_GetDeviceAddress() 3673 3674``` 3675Input_Result OH_Input_GetDeviceAddress(Input_DeviceInfo *deviceInfo, char **address) 3676``` 3677 3678**Description** 3679 3680Obtains the physical address of an input device. 3681 3682**System capability**: SystemCapability.MultimodalInput.Input.Core 3683 3684**Since**: 13 3685 3686 3687**Parameters** 3688 3689| Parameter| Description| 3690| -- | -- | 3691| [Input_DeviceInfo](capi-input-input-deviceinfo.md) *deviceInfo | Input device information. For details, see [Input_DeviceInfo](capi-input-input-deviceinfo.md).| 3692| char **address | Pointer to the physical address of the input device.| 3693 3694**Return value** 3695 3696| Type| Description| 3697| -- | -- | 3698| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if **deviceInfo** or **address** is a null pointer.| 3699 3700### OH_Input_GetFunctionKeyState() 3701 3702``` 3703Input_Result OH_Input_GetFunctionKeyState(int32_t keyCode, int32_t *state) 3704``` 3705 3706**Description** 3707 3708Obtains the function key status. 3709 3710**Since**: 15 3711 3712 3713**Parameters** 3714 3715| Parameter| Description| 3716| -- | -- | 3717| int32_t keyCode | Function key. Only the **CapsLock** key is supported.| 3718| int32_t *state | Function key status. The value **0** indicates that the function key is disabled, and the value **1** indicates that the function key is enabled.| 3719 3720**Return value** 3721 3722| Type| Description| 3723| -- | -- | 3724| [Input_Result](#input_result) | **OH_Input_GetFunctionKeyState** status code, specifically:<br> [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if the parameter is incorrect;<br> {@link INPUT_DEVICE_NOT_EXIST } if the keyboard does not exist.| 3725 3726### OH_Input_InjectTouchEvent() 3727 3728``` 3729int32_t OH_Input_InjectTouchEvent(const struct Input_TouchEvent* touchEvent) 3730``` 3731 3732**Description** 3733 3734Injects a touch event by using coordinates in the relative coordinate system with the upper-left corner of the specified screen as the origin. 3735 3736This API does not take effect if the event injection permission is not granted. 3737 3738Since API version 20, you are advised to use [OH_Input_RequestInjection](#oh_input_requestinjection) to request the required permission before calling this API. If the status returned by [OH_Input_QueryAuthorizedStatus](#oh_input_queryauthorizedstatus) is [AUTHORIZED](capi-oh-input-manager-h.md#input_injectionstatus), then you can call this API. 3739 3740**Since**: 12 3741 3742 3743**Parameters** 3744 3745| Parameter| Description| 3746| -- | -- | 3747| const struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 3748 3749**Return value** 3750 3751| Type| Description| 3752| -- | -- | 3753| int32_t | **OH_Input_InjectTouchEvent** status code, specifically:<br> [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if the parameter is incorrect;<br> [INPUT_PERMISSION_DENIED](#input_result) if the permission is denied.| 3754 3755### OH_Input_InjectMouseEvent() 3756 3757``` 3758int32_t OH_Input_InjectMouseEvent(const struct Input_MouseEvent* mouseEvent) 3759``` 3760 3761**Description** 3762 3763Injects a mouse event by using coordinates in the relative coordinate system with the upper-left corner of the specified screen as the origin. 3764 3765This API does not take effect if the event injection permission is not granted. 3766 3767Since API version 20, you are advised to use [OH_Input_RequestInjection](#oh_input_requestinjection) to request the required permission before calling this API. If the status returned by [OH_Input_QueryAuthorizedStatus](#oh_input_queryauthorizedstatus) is [AUTHORIZED](capi-oh-input-manager-h.md#input_injectionstatus), then you can call this API. 3768 3769**System capability**: SystemCapability.MultimodalInput.Input.Core 3770 3771**Since**: 12 3772 3773 3774**Parameters** 3775 3776| Parameter| Description| 3777| -- | -- | 3778| const struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 3779 3780**Return value** 3781 3782| Type| Description| 3783| -- | -- | 3784| int32_t | **OH_Input_InjectTouchEvent** status code, specifically:<br> [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if the parameter is incorrect;<br> [INPUT_PERMISSION_DENIED](#input_result) if the permission is denied.| 3785 3786### OH_Input_GetMouseEventDisplayId() 3787 3788``` 3789int32_t OH_Input_GetMouseEventDisplayId(const struct Input_MouseEvent* mouseEvent) 3790``` 3791 3792**Description** 3793 3794Obtains the screen ID of a mouse event. 3795 3796**System capability**: SystemCapability.MultimodalInput.Input.Core 3797 3798**Since**: 15 3799 3800 3801**Parameters** 3802 3803| Parameter| Description| 3804| -- | -- | 3805| const struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 3806 3807**Return value** 3808 3809| Type| Description| 3810| -- | -- | 3811| int32_t | Screen ID if the operation is successful; **-1** if **mouseEvent** is null.| 3812 3813### OH_Input_QueryMaxTouchPoints() 3814 3815``` 3816Input_Result OH_Input_QueryMaxTouchPoints(int32_t *count) 3817``` 3818 3819**Description** 3820 3821Queries the maximum number of touch points supported by the device. 3822 3823**Since**: 20 3824 3825**Parameters** 3826 3827| Parameter| Description| 3828| -- | -- | 3829| int32_t *count | Maximum number of touch points supported by the device. The value range is [0, 10]. The value **-1** indicates that the number of touch points is unknown.| 3830 3831**Return value** 3832 3833| Type| Description| 3834| -- | -- | 3835| [Input_Result](capi-oh-input-manager-h.md#input_result) | Operation result.<br>[INPUT_SUCCESS](#input_result): Operation success.<br> [[INPUT_PARAMETER_ERROR](capi-oh-input-manager-h.md#input_result)]: Parameter error.| 3836 3837### OH_Input_InjectMouseEventGlobal() 3838``` 3839int32_t OH_Input_InjectMouseEventGlobal(const struct Input_MouseEvent* mouseEvent) 3840``` 3841 3842**Description** 3843 3844Injects a mouse event by using coordinates in the global coordinate system with the upper-left corner of the primary screen as the origin. 3845 3846This API does not take effect if the event injection permission is not granted. 3847 3848You are advised to use [OH_Input_RequestInjection](#oh_input_requestinjection) to request the required permission before calling this API. If the status returned by [OH_Input_QueryAuthorizedStatus](#oh_input_queryauthorizedstatus) is [AUTHORIZED](capi-oh-input-manager-h.md#input_injectionstatus), then you can call this API. 3849 3850**Since**: 20 3851 3852**Parameters** 3853 3854| Parameter| Description| 3855| -- | -- | 3856| const struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 3857 3858**Return value** 3859 3860| Type| Description| 3861| -- | -- | 3862| int32_t | Operation result.<br> [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if the parameter is incorrect;<br> [INPUT_PERMISSION_DENIED](#input_result) if the permission is denied.| 3863 3864### OH_Input_SetMouseEventGlobalX() 3865``` 3866void OH_Input_SetMouseEventGlobalX(struct Input_MouseEvent* mouseEvent, int32_t globalX) 3867``` 3868 3869**Description** 3870 3871Sets the X coordinate of the mouse event in the global coordinate system with the upper-left corner of the primary screen as the origin. 3872 3873**Since**: 20 3874 3875**Parameters** 3876 3877| Parameter| Description| 3878| -- | -- | 3879| const struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 3880| int32_t globalX | X coordinate of the mouse event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 3881 3882### OH_Input_GetMouseEventGlobalX() 3883 3884``` 3885int32_t OH_Input_GetMouseEventGlobalX(const struct Input_MouseEvent* mouseEvent) 3886``` 3887 3888**Description** 3889 3890Obtains the X coordinate of the mouse event in the global coordinate system with the upper-left corner of the primary screen as the origin. 3891 3892**Since**: 20 3893 3894**Parameters** 3895 3896| Parameter| Description| 3897| -- | -- | 3898| const struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 3899 3900**Return value** 3901 3902| Type| Description| 3903| -- | -- | 3904| int32_t | X coordinate of the mouse event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 3905 3906### OH_Input_SetMouseEventGlobalY() 3907 3908``` 3909void OH_Input_SetMouseEventGlobalY(struct Input_MouseEvent* mouseEvent, int32_t globalY) 3910``` 3911 3912**Description** 3913 3914Sets the Y coordinate of the mouse event in the global coordinate system with the upper-left corner of the primary screen as the origin. 3915 3916**Since**: 20 3917 3918**Parameters** 3919 3920| Parameter| Description| 3921| -- | -- | 3922| const struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 3923| int32_t globalY | Y coordinate of the mouse event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 3924 3925### OH_Input_GetMouseEventGlobalY() 3926 3927``` 3928int32_t OH_Input_GetMouseEventGlobalY(const struct Input_MouseEvent* mouseEvent) 3929``` 3930 3931**Description** 3932 3933Obtains the Y coordinate of the mouse event in the global coordinate system with the upper-left corner of the primary screen as the origin. 3934 3935**Since**: 20 3936 3937**Parameters** 3938 3939| Parameter| Description| 3940| -- | -- | 3941| const struct [Input_MouseEvent](capi-input-input-mouseevent.md)* mouseEvent | Mouse event object. You can call [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) to create a mouse event object.<br>If the mouse event object is no longer needed, destroy it by calling [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent).| 3942 3943**Return value** 3944 3945| Type| Description| 3946| -- | -- | 3947| int32_t | Y coordinate of the mouse event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 3948 3949### OH_Input_InjectTouchEventGlobal() 3950 3951``` 3952int32_t OH_Input_InjectTouchEventGlobal(const struct Input_TouchEvent* touchEvent) 3953``` 3954 3955**Description** 3956 3957Injects a touch event by using coordinates in the global coordinate system with the upper-left corner of the primary screen as the origin. 3958 3959This API does not take effect if the event injection permission is not granted. 3960 3961You are advised to use [OH_Input_RequestInjection](#oh_input_requestinjection) to request the required permission before calling this API. If the status returned by [OH_Input_QueryAuthorizedStatus](#oh_input_queryauthorizedstatus) is [AUTHORIZED](capi-oh-input-manager-h.md#input_injectionstatus), then you can call this API. 3962 3963**Since**: 20 3964 3965**Parameters** 3966 3967| Parameter| Description| 3968| -- | -- | 3969| const struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 3970 3971**Return value** 3972 3973| Type| Description| 3974| -- | -- | 3975| int32_t | Operation result.<br> [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if the parameter is incorrect;<br> [INPUT_PERMISSION_DENIED](#input_result) if the permission is denied.| 3976 3977### OH_Input_SetTouchEventGlobalX() 3978 3979``` 3980void OH_Input_SetTouchEventGlobalX(struct Input_TouchEvent* touchEvent, int32_t globalX) 3981``` 3982 3983**Description** 3984 3985Sets the X coordinate of the touch event in the global coordinate system with the upper-left corner of the primary screen as the origin. 3986 3987**Since**: 20 3988 3989**Parameters** 3990 3991| Parameter| Description| 3992| -- | -- | 3993| const struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 3994| int32_t globalX | X coordinate of the touch event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 3995 3996### OH_Input_GetTouchEventGlobalX() 3997 3998``` 3999int32_t OH_Input_GetTouchEventGlobalX(const struct Input_TouchEvent* touchEvent) 4000``` 4001 4002**Description** 4003 4004Obtains the X coordinate of the touch event in the global coordinate system with the upper-left corner of the primary screen as the origin. 4005 4006**Since**: 20 4007 4008**Parameters** 4009 4010| Parameter| Description| 4011| -- | -- | 4012| const struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 4013 4014**Return value** 4015 4016| Type| Description| 4017| -- | -- | 4018| int32_t | X coordinate of the touch event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 4019 4020### OH_Input_SetTouchEventGlobalY() 4021 4022``` 4023void OH_Input_SetTouchEventGlobalY(struct Input_TouchEvent* touchEvent, int32_t globalY) 4024``` 4025 4026**Description** 4027 4028Sets the Y coordinate of the touch event in the global coordinate system with the upper-left corner of the primary screen as the origin. 4029 4030**Since**: 20 4031 4032**Parameters** 4033 4034| Parameter| Description| 4035| -- | -- | 4036| const struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 4037| int32_t globalY | Y coordinate of the touch event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 4038 4039### OH_Input_GetTouchEventGlobalY() 4040 4041``` 4042int32_t OH_Input_GetTouchEventGlobalY(const struct Input_TouchEvent* touchEvent) 4043``` 4044 4045**Description** 4046 4047Obtains the X coordinate of the touch event in the global coordinate system with the upper-left corner of the primary screen as the origin. 4048 4049**Since**: 20 4050 4051**Parameters** 4052 4053| Parameter| Description| 4054| -- | -- | 4055| const struct [Input_TouchEvent](capi-input-input-touchevent.md)* touchEvent | Touch event object. You can call [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) to create a touch event object.<br>If the touch event object is no longer needed, destroy it by calling [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent).| 4056 4057**Return value** 4058 4059| Type| Description| 4060| -- | -- | 4061| int32_t | Y coordinate of the touch event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 4062 4063### OH_Input_SetAxisEventGlobalX() 4064 4065``` 4066Input_Result OH_Input_SetAxisEventGlobalX(struct Input_AxisEvent* axisEvent, int32_t globalX) 4067``` 4068 4069**Description** 4070 4071Sets the X coordinate of the axis event in the global coordinate system with the upper-left corner of the primary screen as the origin. 4072 4073**Since**: 20 4074 4075**Parameters** 4076 4077| Parameter| Description| 4078| -- | -- | 4079| const [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 4080| int32_t globalX | X coordinate of the axis event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 4081 4082**Return value** 4083 4084| Type| Description| 4085| -- | -- | 4086| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** is a null pointer.| 4087 4088### OH_Input_GetAxisEventGlobalX() 4089 4090``` 4091Input_Result OH_Input_GetAxisEventGlobalX(const Input_AxisEvent* axisEvent, int32_t* globalX) 4092``` 4093 4094**Description** 4095 4096Obtains the X coordinate of the axis event in the global coordinate system with the upper-left corner of the primary screen as the origin. 4097 4098**Since**: 20 4099 4100**Parameters** 4101 4102| Parameter| Description| 4103| -- | -- | 4104| const [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 4105| int32_t* globalX | X coordinate of the axis event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 4106 4107**Return value** 4108 4109| Type| Description| 4110| -- | -- | 4111| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** or **globalX** is a null pointer.| 4112 4113### OH_Input_SetAxisEventGlobalY() 4114 4115``` 4116Input_Result OH_Input_SetAxisEventGlobalY(struct Input_AxisEvent* axisEvent, int32_t globalY) 4117``` 4118 4119**Description** 4120 4121Sets the Y coordinate of the axis event in the global coordinate system with the upper-left corner of the primary screen as the origin. 4122 4123**Since**: 20 4124 4125**Parameters** 4126 4127| Parameter| Description| 4128| -- | -- | 4129| const [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 4130| int32_t globalY | Y coordinate of the axis event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 4131 4132**Return value** 4133 4134| Type| Description| 4135| -- | -- | 4136| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** is a null pointer.| 4137 4138### OH_Input_GetAxisEventGlobalY() 4139 4140``` 4141Input_Result OH_Input_GetAxisEventGlobalY(const Input_AxisEvent* axisEvent, int32_t* globalY) 4142``` 4143 4144**Description** 4145 4146Obtains the Y coordinate of the axis event in the global coordinate system with the upper-left corner of the primary screen as the origin. 4147 4148**Since**: 20 4149 4150**Parameters** 4151 4152| Parameter| Description| 4153| -- | -- | 4154| const [Input_AxisEvent](capi-input-input-axisevent.md)* axisEvent | Axis event object. You can call [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) to create an axis event object.<br>If the axis event object is no longer needed, destroy it by calling [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent).| 4155| int32_t* globalY | Y coordinate of the axis event in the global coordinate system with the upper-left corner of the primary screen as the origin.| 4156 4157**Return value** 4158 4159| Type| Description| 4160| -- | -- | 4161| [Input_Result](#input_result) | [INPUT_SUCCESS](#input_result) if the operation is successful;<br> [INPUT_PARAMETER_ERROR](#input_result) if **axisEvent** or **globalY** is a null pointer.| 4162 4163### OH_Input_GetPointerLocation() 4164 4165``` 4166Input_Result OH_Input_GetPointerLocation(int32_t *displayId, double *displayX, double *displayY) 4167``` 4168 4169**Description** 4170 4171Obtains the coordinates of the mouse pointer on the current screen. 4172 4173**Since**: 20 4174 4175**Parameters** 4176 4177| Parameter| Description| 4178| -- | -- | 4179| int32_t *displayId | Screen ID.| 4180| double *displayX | X coordinate of the mouse pointer on the screen.| 4181| double *displayY | Y coordinate of the mouse pointer on the screen.| 4182 4183**Return value** 4184 4185| Type| Description| 4186| -- | -- | 4187| [Input_Result](#input_result) | Operation result.<br> [INPUT_SUCCESS](#input_result): Operation success.<br> [INPUT_PARAMETER_ERROR](#input_result) if the parameter is incorrect;<br> [INPUT_SERVICE_EXCEPTION](#input_result): Service exception.<br> [INPUT_APP_NOT_FOCUSED](#input_result): Current application not in focus.<br> [INPUT_DEVICE_NO_POINTER](#input_result): No mouse device.| 4188