Text processing method and electronic device
By loading the word library in the text application of the electronic device and injecting all processes when selecting text, the problem of the electronic device being unable to display the service menu is solved, and the user experience and word processing convenience are improved.
Patent Information
- Application Number
- CN202310956998.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-29
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2043-07-29
AI Technical Summary
The electronic device cannot display the service menu normally after selecting the text in the window, resulting in the inability to quickly process the selected text and a low user experience.
In the text application of the electronic device, by loading the word library in the main process and sub-process of the first application, it is ensured that the service menu can be successfully displayed when text is framed, and the selected text can be processed. The specific method includes waiting for the thesaurus to be loaded the second time when the thesaurus is not loaded at the first time, and injecting the thesaurus into all processes after the second application is started to ensure the ability to obtain the framed text.
It effectively solves the problem of the service menu not being displayed, improves the user experience and convenience of processing selected text, avoids users' doubts caused by the menu not being displayed, and ensures the normal use of text applications.
Smart Images

Figure CN117707365B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a text processing method and electronic device. Background Art
[0002] With the development of electronic devices, the types of applications installed in electronic devices are becoming more and more diverse. For example, an electronic device is installed with a text application, which provides a text word retrieval function, that is, after selecting the text in the window, a service menu of the text application is displayed, so that the user can select the function control in the service menu according to the needs, so that the electronic device can perform corresponding operations on the selected text according to the function control selected by the user, such as saving the selected text to the target application, so as to realize the rapid processing of the selected text.
[0003] However, in some cases, after selecting text in the window, the electronic device cannot display the service menu normally, resulting in the inability to provide corresponding services, and the inability to quickly process the selected text, resulting in low user satisfaction. Summary of the invention
[0004] In view of this, the present application provides a text processing method and electronic device, which can ensure the normal display of the service menu of the text application and improve the user experience.
[0005] In a first aspect, the present application provides a text processing method. Applied to an electronic device, at a first time, the electronic device starts a first application, and the first application includes multiple sub-processes. Between the first time and the second time, the main process of the first application and each of the multiple sub-processes are not injected with the first program module, and the main process of the first application and the program modules loaded by each sub-process do not include the first program module (or referred to as a word library). The second time is later than the first time.
[0006] Afterwards, the electronic device may display the first window of the first application, the first window including the selectable text (such as the first text). Since the program modules loaded by the main process and each subprocess of the first application do not include the first program module, after the text in the selectable text is selected in the first window, the electronic device does not display the first menu of the second application.
[0007] Thereafter, at a second time, in response to a start-up operation of a second application of the electronic device (such as operation 1), the electronic device may start the second application.
[0008] After selecting words in the selectable text in the first window, the first menu of the second application is displayed at a third time. After the third time, the main process of the first application and the program modules loaded by each subprocess include the first program module. The third time is later than the second time.
[0009] The first program module is used to send the text selected in the first window to the second application. The first menu includes at least one function control, each of which is used to trigger the electronic device to perform corresponding processing on the selected text.
[0010] The first window is a focus window.
[0011] In the present application, after the second application is started, since the main process of the first application and each sub-process of the first application are loaded with the first program module, and the process corresponding to the first window is a process of the first application, the process corresponding to the first window is loaded with the first program module, so that the second application can obtain the text selected in the first window of the first application, so that the electronic device can successfully display the first menu of the second application (such as the service menu of the text application), ensuring that the second application can be used normally, avoiding the user's doubts about why the electronic device cannot generate the first menu after selecting the text, and improving the user's satisfaction. And it can enable the user to use the function controls provided by the first menu according to the needs, improve the convenience of processing the selected text, and improve the user experience.
[0012] In one possible design, after the second application is started, the electronic device may inject the first program module into each process of the first application (such as the main process of the first application and each sub-process), so that each process of the first application is loaded with the first program module. When the process corresponding to the focus window is any process of the second application, the first application can obtain the text selected in the focus window, thereby ensuring the normal display of the service menu of the first application.
[0013] In a possible implementation, in order to frame the selectable text, the user can press the left mouse button at the starting position of the text to be framed and move the mouse. When the user moves the cursor to the desired end position, the user can release the left mouse button. Optionally, the mouse can be a built-in mouse (such as a touchpad, or touchpad) of the electronic device, or an external mouse of the electronic device.
[0014] In a possible design, after the second application is started, in response to a left mouse button press event, the electronic device can inject the first program module into the main process and each sub-process of the first application through the second application.
[0015] In the present application, after receiving the left mouse button press event, the first program module is injected into the main process and each child process of the first application respectively, so that before the selectable text in the first window is selected, the first program module exists in each process of the first application, so that the first program module can successfully read the text selected by the user, so that the second application can successfully obtain the text selected by the user, and the accuracy of the selected text obtained by the second application is guaranteed.
[0016] Optionally, the above-mentioned left mouse button release event may be a mousedown event.
[0017] In a possible design, the electronic device can directly determine the main process of the first application. The process of the electronic device determining the sub-process of the first application may include:
[0018] The electronic device traverses to obtain other processes, which include processes running on the electronic device except the main process of the first application; the main process of the first application is the parent process of the first application, that is, the parent process identifier of the child process of the first application is the same as the main process identifier of the first application.
[0019] For each process in other processes, when the parent process identifier of the process is the same as the identifier of the main process of the first application, the process is a child process of the first application, thereby achieving the determination of the child process of the first application.
[0020] In one possible design, after the electronic device selects the text in the selectable text in the first window, that is, after selecting the text in the selectable text in the first window, it can use the first program module to obtain the selected text, thereby displaying the first menu of the second application for the selected text, thereby achieving successful display of the first menu of the second application.
[0021] In one possible design, when the user wants to stop selecting the text in the first window, the user can release the left mouse button, and the electronic device can respond to the left mouse button release event by sending a first copy command to the process corresponding to the first window through the operating system of the electronic device; the process corresponding to the first window can be a child process.
[0022] The electronic device obtains the selected text through the second application and displays a first menu for the selected text, wherein the selected text is sent by the process corresponding to the first window in response to the first copy command by calling the first program module.
[0023] The above-mentioned left mouse button release event may be a mousedown event.
[0024] In the present application, the electronic device directly determines the process corresponding to the first window through the OS, and then sends a first copy command to the process corresponding to the first window to trigger the process corresponding to the first window to use the first program module to send the selected text to the second application, so that the second application successfully obtains the selected text.
[0025] Optionally, the first copy command may be a Ctrl+C command.
[0026] In a possible design, in the process of selecting text by moving the mouse, in response to a mouse movement event, the current focus window is determined to be the second window.
[0027] The electronic device determines whether the second window is the same as the first window, that is, determines whether the mouse cursor moves from the first window to another window.
[0028] When the second window is different from the first window, it indicates that the mouse cursor has moved to another window. Since text in multiple windows cannot be selected at the same time, the second application does not need to obtain the selected text. Therefore, the electronic device may not display the first menu in response to the left mouse button release event.
[0029] Among them, optionally, when the second window is different from the first window, the electronic device does not send the first copy command to the process corresponding to the first window through the OS. Accordingly, the process corresponding to the first window does not need to send the selected text, thereby avoiding unnecessary sending of copy commands and unnecessary acquisition of selected text, thereby reducing waste of resources.
[0030] Optionally, the process of the electronic device determining whether the second window is the same as the first window may include:
[0031] The electronic device can obtain the process identifier corresponding to the second window and the process identifier corresponding to the first window.
[0032] If the process identifier corresponding to the second window is the same as the process identifier corresponding to the first window, it indicates that the second window is the same as the first window. If the process identifier corresponding to the second window is different from the process identifier corresponding to the first window, it indicates that the second window is different from the first window.
[0033] In a possible design, after the second application is started, the user releases the left mouse button to indicate that the text selection stops, and the electronic device can determine whether the starting position and the ending position of the mouse are the same. The starting position indicates the position of the mouse cursor when the left mouse button is pressed, and the ending position of the mouse indicates the position of the mouse cursor when the left mouse button is released.
[0034] When the starting position and the ending position are the same, it indicates that the position of the left mouse button when it is pressed is the same as the position when it is released, which means that the mouse cursor has not moved or the mouse cursor has returned to the starting position after moving, which means that the user has not selected text, and the electronic device does not need to display the above-mentioned first menu.
[0035] Among them, optionally, when the starting position and the ending position are the same, the electronic device may send the first copy command to the process corresponding to the first window without going through the OS. Accordingly, the process corresponding to the first window does not need to send the selected text, thereby avoiding unnecessary sending of copy commands and unnecessary acquisition of selected text, thereby reducing waste of resources.
[0036] In another possible design, when the starting position and the ending position are different, it indicates that the position when the left mouse button is pressed is different from the position when it is released, which means that the mouse user may have selected text. After the electronic device obtains the selected text through the second application, it can continue to display the first menu.
[0037] In one possible design, in response to a left mouse button release event, the electronic device may determine whether a mouse move event is received from the time the left mouse button is pressed to the time the left mouse button is released, to determine whether the mouse moves.
[0038] When a mouse movement event is received, it indicates that the mouse has moved and the user may have selected text. After the electronic device obtains the selected text through the second application, it can continue to display the first menu.
[0039] When no mouse movement event is received, it indicates that the mouse has not moved, there is no boxed text, and the electronic device does not need to display the above-mentioned first menu.
[0040] Wherein, optionally, the mouse event has a corresponding timestamp, and the timestamp indicates the time when the mouse event occurs. Accordingly, the above process from receiving the left mouse button press event to receiving the left mouse button release event, and whether the mouse move event is received may include:
[0041] The electronic device can determine whether there is a mouse movement event whose timestamp is within the target period. The start time of the target period is the time when the left mouse button is pressed, that is, the start time can represent the timestamp corresponding to the left mouse button pressed event. The end time of the target period represents the time when the left mouse button is released, that is, the end time can represent the timestamp corresponding to the left mouse button released event.
[0042] In the case where there is a mouse move event whose timestamp is within the target time period, it indicates that the user moved the mouse between the time when the user pressed the left mouse button and the time when the user released the left mouse button, and the electronic device can determine that the mouse move event has been received. In the case where there is no mouse move event whose timestamp is within the target time period, it indicates that the user did not move the mouse between the time when the user pressed the left mouse button and the time when the user released the left mouse button, and the state machine can determine that the mouse move event has not been received, thereby achieving accurate judgment of whether the mouse has moved from the time when the left mouse button is pressed to the time when the left mouse button is released.
[0043] In a possible design, in response to a mouse left button press event, the electronic device determines through the second application whether the mouse left button press event belongs to a preset event of the second application. If not, it indicates that the second application does not need to respond to the mouse left button press event, and the electronic device may not respond to the mouse left button press event, thereby avoiding unnecessary event processing.
[0044] In one possible design, after selecting text in the first window, the selected text is not displayed on the clipboard, so as to prevent other people from viewing the selected text through the clipboard, thereby protecting the security of user data and preventing user data from being leaked.
[0045] In a possible design, after selecting text in the first window, the electronic device can call the first program module to not display the selected text on the clipboard. Optionally, the first program module is used to intercept the first application and write the selected text to the clipboard, thereby avoiding displaying the selected text on the clipboard.
[0046] In a possible design, the above mouse event (such as a left mouse button event) is only an example of triggering the electronic device to select text, and the user can also trigger the electronic device to select text by inputting other operations, such as a long press operation on the touch screen of the electronic device, a click operation (such as a double click operation). In other words, the electronic device can select text in response to a first event, and the first event can be the above mouse event, or other events, such as a long press event, a click event, etc.
[0047] Accordingly, in response to the first event, the electronic device can inject the first program module into each process of the first application through the second application.
[0048] In a second aspect, the present application provides an electronic device, comprising a display screen, a memory and one or more processors; the display screen, the memory and the processor are coupled; the display screen is used to display an image generated by the processor, and the memory is used to store computer program code, wherein the computer program code comprises computer instructions; when the processor executes the computer instructions, the electronic device executes a text processing method as described in any one of the above-mentioned first aspects.
[0049] In a third aspect, the present application provides a computer-readable storage medium, comprising computer instructions, which, when executed on an electronic device, enables the electronic device to execute a text processing method as described in any one of the above-mentioned first aspects.
[0050] In a fourth aspect, the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the text processing method as described in any one of the first aspects above.
[0051] It can be understood that the beneficial effects that can be achieved by the electronic device described in the second aspect, the computer storage medium described in the third aspect, and the computer program product described in the fourth aspect provided above can refer to the beneficial effects in the first aspect and any possible implementation method thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1A A schematic diagram 1 of starting a text application provided in an embodiment of the present application;
[0053] Figure 1B A second schematic diagram of starting a text application provided in an embodiment of the present application;
[0054] Figure 2A A schematic diagram of a mouse word selection provided in an embodiment of the present application;
[0055] Figure 2B A second schematic diagram of a mouse word selection provided in an embodiment of the present application;
[0056] Figure 2C A mouse word stroke diagram provided in an embodiment of the present application Figure 3 ;
[0057] Figure 2D A fourth schematic diagram of a mouse word selection provided in an embodiment of the present application;
[0058] Figure 2E A mouse word stroke diagram provided in an embodiment of the present application Figure 5 ;
[0059] Figure 2FA mouse word stroke diagram provided in an embodiment of the present application Figure 6 ;
[0060] Figure 2G A mouse word stroke diagram provided in an embodiment of the present application Figure 7 ;
[0061] Figure 3 A schematic diagram of a screenshot word extraction method provided in an embodiment of the present application;
[0062] Figure 4A A schematic diagram of a text application startup provided in an embodiment of the present application Figure 3 ;
[0063] Figure 4B Schematic diagram 4 of starting a text application provided in an embodiment of the present application;
[0064] Figure 5 A flowchart of a mouse word retrieval method provided in an embodiment of the present application is shown in FIG1;
[0065] Figure 6 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0066] Figure 7 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;
[0067] Figure 8 A flowchart of a text processing method provided in an embodiment of the present application;
[0068] Fig. 9 A schematic diagram of a note text provided in an embodiment of the present application;
[0069] Fig. 10A A schematic diagram 1 of a text application exit provided in an embodiment of the present application;
[0070] Fig. 10B A second schematic diagram of a text application exit provided in an embodiment of the present application;
[0071] Fig. 10C A schematic diagram of a text application exit provided in an embodiment of the present application Figure 3 ;
[0072] Fig.11 A second schematic diagram of a process of mouse word retrieval provided in an embodiment of the present application; DETAILED DESCRIPTION
[0073] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or design. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way. In the embodiments of the present application, "at least one" refers to one or more, and "multiple" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B, which can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following items (individuals)" or similar expressions thereof refer to any combination of these items, including any combination of single items (individuals) or plural items (individuals). For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple. In the embodiments of the present application, "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" can explicitly or implicitly include one or more of the features. In the description of the present embodiment, unless otherwise specified, the meaning of "multiple" is two or more.
[0074] Some electronic devices (such as personal computers (PCs)) provide a word-picking function, so that users can use the word-picking function to select text and process the selected text. For example, the PC is installed with a text application. The user can click on Figure 1A The first control 11 of the text application on the housekeeper interface 10 shown in FIG. Figure 1A The mouse operation click shown can also be performed by Figure 1A The touchpad on the PC shown in the figure operates clicks. The touchpad can also be called a built-in mouse. Figure 1A The mouse shown in the figure can also be called an external mouse. The PC has established a connection with the mouse, and the mouse can be used as an input device of the PC. The connection can be as described above. Figure 1A The wireless connection shown (such as Bluetooth connection) or the connection may also be a wired connection, and the present application does not limit the connection method between the PC and the mouse.
[0075] Among them, on the display interface (such as the above-mentioned housekeeper interface 10), the first control of the text application can be presented as the first icon of the text application, that is, the first control of the text application can be presented in the form of an icon. Alternatively, the first control of the text application can be presented as the second control of the text application described below.
[0076] In response to the click operation on the first control 11 of the text application, the PC starts the text application and displays the following on the displayed interface: Figure 1B The second control 12 of the text application shown in the figure indicates that the text application on the PC has been started. After the text application is started, the text application provides a word retrieval function, which may include text word retrieval (or mouse word retrieval) and / or picture word retrieval (or screenshot word retrieval). Users can perform text word retrieval or picture word retrieval according to their needs. Among them, the second control of the text application can be presented as a second icon of the text application on the interface, that is, the second control of the text application can be presented in the form of an icon.
[0077] For example, the PC displays Figure 2A When the user wants to select part of the text in the travel guide document 20, the user can use the text application to select the text, the user can move the mouse cursor to the starting position of the text to be selected, and then press the left mouse button (such as Figure 2B As shown), the mouse is moved, and the PC responds to the user pressing the left button of the mouse, and sets the text passed by the cursor during the movement to the selected state (as shown in FIG. Figure 2C ), in other words, the text that the cursor passes through during the movement becomes the selected text. When the user moves the cursor to the desired end position, the user can release the left mouse button (such as Figure 2D In response to the release of the left mouse button, the PC stops setting the text to the selected state and displays the following: Figure 2E The menu 13 shown includes several functional controls: copy control, translation control, search control, jump control, read aloud control, and save to note application.
[0078] The sharing control is used to trigger the tablet computer to share the selected characters, such as sharing them with an application on the tablet computer.
[0079] The above copy control is used to trigger the PC to copy the selected text, so that the user can paste the selected text to other locations as needed without the user having to re-enter the selected text.
[0080] The above translation control is used to trigger the PC to translate the selected text from the current language into another language.
[0081] The above-mentioned search control is used to trigger the PC to search with the selected text as a keyword, such as searching for the selected text in a browser application.
[0082] The jump control is used to jump the PC to the interface corresponding to the link address in the selected text. Exemplarily, the text selected by the user includes the link address, and when the user clicks the jump control, the PC responds to the click operation of the jump control and accesses the link address to achieve quick access.
[0083] The above-mentioned reading control is used to trigger the PC voice to play the selected text.
[0084] The above-mentioned save to note application control is used to trigger the PC to save the selected text into the note application, that is, save it into a note of the note application, so as to realize fast saving of text and improve user satisfaction.
[0085] Afterwards, the user can select the function control shown in the menu 13 according to the use requirements. For example, if the user wants to play the selected text by voice, the user can click the read control in the menu 13 (such as Figure 2F In response to the click operation of the read aloud control, the PC plays the selected text by voice, that is, the voice plays "10 o'clock to 12 o'clock go to xx park" (as shown in FIG. Figure 2G shown).
[0086] For example, if a user wants to select text that cannot be selected on a PC display, such as text in an image or the name of a control, the user can take a screenshot to capture the text. Figure 3 In the second control 21 of the text application shown in (a), the PC switches the second control 21 of the text application to another display state in response to the user's click operation on the second control 21 of the text application, such as Figure 3 The second control 22 of the text application shown in (b) is Figure 3 The color of the second control 21 of the text application shown in (a) is different, indicating that the PC has entered the screenshot word acquisition state, and the PC can display the PC as shown in FIG. Figure 3 Take a screenshot of the interface shown in (a) to obtain image 23, identify all the text in image 23, and set all the text in the icon to a highlighted state (such as Figure 3 (b)). Among them, Figure 3 The highlighted text shown in (b) can be selected by the user, that is, it becomes a frame-selectable state.
[0087] Afterwards, when the user wants to select part of the highlighted text, the user can move the mouse cursor to the starting position of the text to be selected, then press the left mouse button and start moving the mouse. In response to the user's pressing and dragging operation of the left mouse button, the PC sets the text that the cursor passes through during the movement to the selected state according to the movement of the mouse. In other words, the text that the cursor passes through during the movement becomes the selected text. When the user moves the cursor to the desired end position, the user can release the left button. In response to the release of the left mouse button, the PC stops setting the text to the selected state and displays the above-mentioned Figure 2E Menu 13 is shown.
[0088] It should be understood that the above Figure 3 (a) and Figure 3 The color of the second control of the text application shown in (b) is only an example. In other words, the color of the second control of the text application is gray before it is clicked and blue after it is clicked. This is only an example. The present application does not limit the color of the second control of the text application before and after it is clicked. For example, before clicking the second control of the text application, the color of the second control of the text application displayed by the PC is blue, which indicates that the PC supports text capture but not screenshot capture. After the second control of the text application is clicked, the color of the second control of the text application is yellow, which indicates that the PC supports screenshot capture.
[0089] In addition, the text for the above text extraction is a selectable text, that is, a selectable text. For example, the selectable text in the present application can be a text that can be copied. For example, in some scenarios, the selectable text can be an editable text. In other scenarios, for text that cannot be selected, such as text information in a picture, the PC will not be able to select the text content in the picture through text extraction.
[0090] In some embodiments, the above-described method of starting a text application through the housekeeper is only an example, and the text application can also be started through other methods. For example, the user uses the mouse to click on the PC displayed as Figure 4A The third control 31 of the text application in the sidebar 30 shown in FIG. In response to the click operation of the second control 31 of the text application, the PC starts the text application and displays the following on the displayed interface: Figure 4B The second control 32 of the text application shown in the figure indicates that the text application on the PC has been started. After the second control 31 of the text application in the sidebar 30 is clicked, the second control 31 of the text application switches to the selected state (such as Figure 4BThe second control 33 of the text application shown in the figure, such as the selected state can be a blue display state, before the text application is started, the second control 31 of the text application in the sidebar 30 can be gray, and after the text application is started, the second control 33 of the text application in the sidebar 30 can be blue. The second control 31 of the text application in the sidebar 30 can also be replaced by a third control of the text application, and the third control can be the same as or different from the second control. The third control of the text application can be presented as a third icon of the text application on the interface, that is, the third control of the text application can be presented in the form of an icon.
[0091] The above briefly introduces the word-picking functions provided by the text application, such as picture word-picking and text word-picking. In order to implement text word-picking, the text application in the PC first needs to obtain the text selected by the user on the text opened by the third-party application (such as the above-mentioned document application), and then trigger the PC to display the corresponding service menu (such as the above-mentioned menu 13). FIG. 2A to FIG. 2E , continue to introduce the specific implementation process of text word extraction, such as Figure 5 As shown, the specific implementation process may include:
[0092] First, in response to the user's left-button-pressing operation, the operating system (OS) in the PC may execute step A to send the left-button-pressing event to the event monitor in the text application and the focus process of the office application. The office application is the application to which the document 20 belongs, that is, the application to which the window displaying the document 20 belongs, and the focus process is the process corresponding to the focus window (such as the window where the mouse cursor is located), that is, the process corresponding to the window displaying the document 20.
[0093] Afterwards, after receiving the above-mentioned left-button-pressed event, the event monitor in the text application may execute step B, sending the left-button-pressed event to the state machine.
[0094] Afterwards, after receiving the left mouse button press event, the state machine may execute step C, injecting the word library into the main process of the office application based on the injector.
[0095] Afterwards, the user holds down the left mouse button and moves the mouse, and the OS can execute step D, sending a mouse movement event to the focus process of the office application. In response to the mouse movement event, the focus process sets the text that the mouse cursor passes through to a selected state. Afterwards, the user releases the left mouse button, and in response to the user's release operation of the left mouse button, the OS can execute step E, sending a left mouse button release event to the focus process of the office application and the event monitor.
[0096] Afterwards, after receiving the left mouse button release event, the event monitor may execute step F, sending the left mouse button release event to the state machine. After receiving the left mouse button release event, the state machine may execute step G, sending the first copy command to the office application.
[0097] After receiving the left mouse button release event, the office application can stop moving the mouse cursor, that is, stop adding the selected text. After receiving the first copy command, the office application can execute step H, read the selected text by retrieving the word library, and send the selected text to the main process of the text application. After that, the main process of the text application triggers the PC to display the above menu 13 after receiving the selected text.
[0098] However, since the text application determines the main process corresponding to the focus window (i.e., the main process of the above-mentioned office application) based on the focus window, it injects the word library into the main process corresponding to the focus window. When the focus process is not the main process of the office application, but a sub-process of the office application, it indicates that the document 20 is displayed in the window corresponding to the sub-process of the office application, and the sub-process of the office application, that is, the focus process, is not injected with the word library. The focus process cannot use the word library to send the selected text to the text application, which causes the text application to fail to obtain the selected text, that is, the corresponding menu cannot be displayed, resulting in an abnormality in the word retrieval function. The process causes the use of the text application to be abnormal, which makes the user wonder why there is no response, thereby reducing the user's satisfaction.
[0099] The process corresponding to the window (such as the main process corresponding to the above-mentioned focus window) refers to the process that allocates the resources (such as memory, CPU resources, etc.) required for the operation of the window. The window can run in the process corresponding to the window and is part of the process.
[0100] It should be noted that after opening multiple documents through an office application, a subprocess of the office application may be responsible for managing at least one of the multiple documents, that is, the subprocesses corresponding to the windows to which the documents belong may be the same or different as described above. Figure 2B The window to which the travel guide document belongs corresponds to the subprocess 1 of the office application, and the window to which the class notes document belongs corresponds to the subprocess 2 of the office application. The subprocess 1 and the subprocess 2 may be the same process or may not be the same process.
[0101] Therefore, in response to the above problems, the present application proposes a text processing method. After the text application on the electronic device is started, the user uses the mouse to draw words on a text (such as the first text) displayed on the electronic device, that is, to select the text. The electronic device first sends a left mouse button press event to the text application and the focus process corresponding to the window including the text. In response to the left mouse button press event, the text application determines the main process and all sub-processes of the application to which the window including the text belongs. Afterwards, the text application injects the word library into the main process of the application and each of the sub-processes.
[0102] Afterwards, the mouse stops marking words, that is, the left mouse button is released. Since the main process and each subprocess include a word library, they all have the ability to read and send the selected text, but only the process that receives the mouse event (such as the left mouse button press event) will respond to the word library and send the selected text to the text application, so that the text application can successfully obtain the content selected by the user, avoiding the text application being unable to obtain the selected content because the focus process is not the main process, thereby ensuring the normal use of the text application. Afterwards, after receiving the selected text, the text application triggers the electronic device to display a first menu, which includes at least one function control, and each of the at least one function control is used to trigger the electronic device to perform corresponding processing on the selected text, so that the user can select the function control according to the needs, improve the convenience of processing the selected text, and improve the user experience.
[0103] Exemplarily, the electronic device in the embodiments of the present application may be a mobile phone, a tablet computer, a wearable device, a personal digital assistant (PDA), a PC (such as a laptop computer, a desktop computer), or other device that can install text applications. The embodiments of the present application do not impose any special restrictions on the specific form of the electronic device.
[0104] For example, Figure 6 A schematic structural diagram of an electronic device 100 is shown.
[0105] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a charging management module 130, a power management module 131, an antenna 1, a wireless communication module 140, an audio module 150, a speaker 150A, a receiver 150B, a microphone 150C, a headphone interface 150D, a sensor module 160, a display screen 170, and the like.
[0106] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0107] The processor 110 may include one or more processing units, for example, the processor 110 may include a central processing unit (CPU), wherein different processing units may be independent devices or integrated into one or more processors.
[0108] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0109] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0110] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, and / or a universal serial bus (USB) interface, etc.
[0111] In some embodiments, the USB interface 130 is an interface that complies with the USB standard specification, and can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect external input devices (e.g., a mouse, a keyboard). Among them, the mouse includes a wireless mouse, a wired mouse, etc.
[0112] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0113] The charging management module 130 is used to receive charging input from a charger and can provide power to the electronic device through the power management module 131 .
[0114] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the wireless communication module 140, the modem processor and the baseband processor.
[0115] The antenna 1 is used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization rate of the antennas.
[0116] The wireless communication module 140 can provide wireless communication solutions including wireless local area networks (WLAN) (such as Wi-Fi (wireless fidelity) network), Bluetooth (BT), etc. applied to the electronic device 100. The wireless communication module 140 can be one or more devices integrating at least one communication processing module. The wireless communication module 140 receives electromagnetic waves via the antenna 1, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 140 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 1.
[0117] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the wireless communication module 140 so that the electronic device 100 can communicate with a network and other devices through wireless communication technology.
[0118] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0119] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0120] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 150, the speaker 150A, the receiver 150B, the microphone 150C, the headphone jack 150D, and the application processor.
[0121] The electronic device 100 implements a display function through the display screen 170 .
[0122] The sensor module 160 may include a temperature sensor, which is used to detect temperature.
[0123] In some embodiments, the sensors listed above are only examples, and the electronic device 100 may also include other sensors, which are not limited by the present application. For example, the electronic device may also include a magnetic sensor. The magnetic sensor includes a Hall sensor. In some embodiments, when the electronic device 100 is a laptop computer, the electronic device 100 may detect the opening and closing of the laptop computer based on the magnetic sensor.
[0124] In addition, the components included in the electronic device shown in the embodiment of the present application are only schematic illustrations and do not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0125] Exemplarily, the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention takes a Windows system with a layered architecture as an example to exemplify the software structure of the electronic device 100.
[0126] Figure 7 1 is a block diagram of the electronic device 100 of the embodiment of the present application. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the above OS is Windows TM For example, Windows TM The system is divided into three layers, from top to bottom: application layer, application middle layer (or middle layer) and system layer.
[0127] Among them, the above application layer includes a series of application packages, such as Figure 7 As shown, the application layer may include text applications, office applications, social applications, note applications, service processes, etc.
[0128] Among them, the text application provides word retrieval functions, such as mouse word selection and word capture.
[0129] Office applications support users to create new documents, edit documents, open documents, etc.
[0130] Social applications can provide social functions, such as supporting users to chat with other users; they also provide functions such as browsing web pages through a browser.
[0131] The service process provides a service menu for the selected text, and the service menu includes at least one function control, which is used to trigger corresponding operations on the selected text, such as copying, searching, translating, saving to a specific application (such as a note application), etc.
[0132] The application middle layer provides a series of services and functions, and provides an interface and coordination between the application layer and the system layer. The application middle layer is responsible for managing the hardware resources of the electronic device 100 and providing access to and control over these hardware resources. Figure 7 As shown, the application middle layer may include event listeners and state machines.
[0133] The event listener and the state machine may be two threads of the text application, and the event listener may be used to receive events from an input device (such as a mouse) and send the events to the state machine. The state machine may be based on injecting a word library into a process of a third-party application of the electronic device. Optionally, the event listener and the state machine may be two threads started by the main process of the text application.
[0134] The above system layers include WindowsTM Kernel. Among them, Windows TM The kernel at least includes related drivers (such as mouse driver, keyboard driver, etc.). The system layer can communicate with the hardware layer.
[0135] Understandably, Figure 7 The layers in the illustrated structure and the components included in each layer do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the structure may include more or fewer layers than shown, and each layer may include more or fewer components, which is not limited in the present application.
[0136] In addition, the OS of the electronic device may be the Windows TM system, or other systems, such as Android TM system, and this application is not limited to it.
[0137] The electronic device is installed with application 1 (such as the above-mentioned text application), which provides a word retrieval function. After application 1 is started, the user holds down the left mouse button and moves the mouse to select text on the text opened by the electronic device through a third-party application (i.e., application 2). After receiving the left mouse button press event, application 1 responds to the left mouse button press event and injects a word retrieval library into all processes of application 2, so that all processes of application 2 have a word retrieval library, so that application 1 can obtain the text selected by the mouse, ensuring the normal use of the word retrieval function, avoiding the situation where the focus process of application 2 cannot be injected with the word retrieval library due to the inconsistency between the main process and the focus process of application 2, resulting in the inability of application 1 to obtain the text selected by the user, thereby avoiding the user's doubts about why application 1 does not respond after selecting the text, and improving the user's satisfaction.
[0138] The following will take the electronic device as a PC as an example, combined with the above Figure 7 The software structure shown in the figure specifically introduces a text processing method provided by the embodiment of the present application. Figure 8 As shown, the method includes S1-S19.
[0139] S1. A PC receives an operation 1 input by a user. The operation 1 is used to trigger the PC to start an application 1.
[0140] S2. The PC starts application 1 in response to operation 1.
[0141] For example, the above operation 1 can be input by the user through a mouse (such as an external mouse or a built-in mouse). When the user wants to use the word-capturing function of application 1 (or the second application), the user can start application 1 on the PC through the mouse, that is, the user can use the mouse to input operation 1 for application 1. For example, application 1 is a text application, and operation 1 can be input by the user using the mouse to access the above application. Figure 1A The first control 11 of the text application on the housekeeper interface 10 shown in FIG. 1 is a click operation (such as a left-click operation of a mouse). For another example, operation 1 is a click operation (such as a left-click operation of a mouse) of the first control 11 of the text application on the housekeeper interface 10 shown in FIG. Figure 4A The text in the sidebar 30 is shown as a click operation on the second control 31 of the application.
[0142] In addition, the above-mentioned operation 1 can also be other operations that can trigger the PC to start application 1. For example, if the display screen of the PC is a touch screen, the user inputs a click operation on the first control 11 of the above-mentioned text application or the second control 31 of the above-mentioned text application on the display screen. Here, the click operation on the first control 11 of the text application or the second control 31 of the text application can be operation 1.
[0143] Afterwards, after receiving the operation 1, the PC can start the application 1 on the PC in response to the operation 1, and the main process of the application 1 is pulled up. After the application 1 is started, the application 1 can enter the text word acquisition state.
[0144] The mouse may be an external mouse of the PC or a built-in mouse of the PC.
[0145] S3, the PC receives operation 2 input by the user. The operation 2 is used to trigger the PC to open the first text.
[0146] S4. The PC displays a first text in response to operation 2, wherein the first text belongs to application 2.
[0147] Among them, application 2 (or referred to as the first application) refers to the application to which the window displaying the first text belongs, that is, the window of the first text is displayed through the application to which the window of the first text belongs, and the content of the first text is loaded. Displaying the first text can be understood as opening the first text and displaying the window of the first text, and the window of the first text contains the specific content of the first text.
[0148] Exemplarily, the PC can open the first document through application 2. For example, the first document is a document (such as a document in doc format), and the user uses the mouse to input an open operation for the document. In response to the open operation, the PC runs the office application on the PC, opens the document, and displays the document (as described above). Figure 2AThe office application here may be application 2. The opening operation for the document may be operation 2. For another example, the first text is a note. The PC opens the note selected by the user with the mouse (such as Fig. 9 Note 1 shown. Here, the note application to which the note belongs is application 2, and the opening operation for the note is operation 2. Of course, the opening operation of the document input by the user through the mouse introduced here is only an example of operation 2, and the operation 2 can also be other operations that can trigger the PC to open the first text. For example, if the display screen of the PC is a touch screen, operation 2 can be an operation input by the user on the display screen to trigger the PC to open the first text. For example, the user clicks the first text displayed on the display screen with his finger. Here, the clicking operation of the user's finger on the first text can be operation 2.
[0149] S5. The OS in the PC sends a left-button-pressing event to Application 1 and Application 2 in response to the user's pressing of the left-button of the mouse.
[0150] Exemplarily, the OS sends a mouse left button press event to the first child process in application 2. The first child process is the child process of application 2 corresponding to the window where the mouse cursor is located (i.e., the focus window), and the first child process is the focus process of application 2. The focus window can be the window currently selected by the user (for example, the user selects the window of the video player to watch the video, and the window of the video player is the focus window), or the window where the mouse cursor is located (for example, the user clicks the above Figure 2A The text in the travel guide document 20 shown, the window displaying the travel guide document 20 is the focus window).
[0151] In the embodiment of the present application, after application 1 is started, the PC enters the text retrieval state. The mouse cursor is in the first text, and the user presses the left mouse button. Since both the event monitor of application 1 and application 2 register to monitor mouse events, the OS in the PC (or described as the PC) sends the left mouse button press event to the focus process of application 1 and application 2 (that is, the first subprocess mentioned above).
[0152] Among them, the OS can directly determine the process corresponding to the focus window, so that the OS can directly send the left mouse button press event to the focus process corresponding to the focus window.
[0153] Exemplarily, the above-mentioned left mouse button pressing event may be a mousedown event.
[0154] In some embodiments, when the left mouse button is pressed, the OS sends the left mouse button press event to the process corresponding to the focus window where the mouse cursor is located. If the process corresponding to the focus window is not the process of Application 2, then the OS will not need to send the left mouse button press event to Application 2. For example, the first text mentioned above is a document, and Application 2 is an office application. The first text is not displayed in full screen, and the PC not only displays the document, but also displays a note of the note application. When the mouse cursor is in the note, the user presses the left mouse button, and the focus window is the window where the note is located. Correspondingly, the focus process is a process of the note application. The OS sends the left mouse button press event to Application 1 and the focus process of the note application respectively, without sending the left mouse button press event to the office application.
[0155] The above focus window may also refer to the window where the mouse pointer is located, which may be briefly described as the window where the mouse is currently located.
[0156] S6. The event monitor in application 1 sends a mouse left button pressed event to the state machine in application 1.
[0157] In some embodiments, the event monitor registers to monitor mouse events. When the user operates the mouse, the OS in the PC sends the corresponding mouse event to the event monitor. The event monitor receives the mouse event and can filter the mouse event, that is, determine whether the mouse event belongs to a preset event (such as a left mouse button pressed event, a mouse moving event, and a left mouse button released event). In the case where the received mouse event belongs to a preset event, the event monitor sends the mouse event to the state machine, and in the case where the received mouse event does not belong to a preset event, the event monitor does not send the mouse event to the state machine. Exemplarily, after receiving the left mouse button pressed event sent by the OS, the event monitor can send the left mouse button pressed event to the state machine, wherein the left mouse button pressed event belongs to a preset event. If the left mouse button pressed event does not belong to a preset event, the event monitor does not need to send the left mouse button pressed event to the state machine. Through the mouse event filtering method, the state machine can only receive the mouse events it needs, avoiding it from receiving all mouse events, thereby avoiding unnecessary response processing, thereby avoiding unnecessary event processing.
[0158] S7. In response to the left mouse button pressing event, the state machine determines the main process of application 2 corresponding to the window where the mouse cursor is located and all sub-processes of application 2. Among them, all sub-processes of application 2 include the first sub-process and the second sub-process.
[0159] For example, application 1 may call a state machine in response to a left mouse button press event to determine a main process of application 2 and all sub-processes of application 2 corresponding to the window where the mouse cursor is located.
[0160] S8. The state machine injects the word library into the main process of application 2 and each sub-process of application 2 respectively.
[0161] Exemplarily, application 1 calls the state machine to inject the word library into the main process of application 2 and each child process of application 2.
[0162] The above-mentioned word library is used to read the selected words in the first text and send the selected words to the application 1.
[0163] In the embodiment of the present application, when the mouse cursor is on the first text, the user presses the left mouse button, indicating that the user may want to select (or select) the text in the first text. Since the state machine can determine the main process of application 2 to which the focus window belongs, the state machine can inject the word library into the main process of application 2. And since the state machine cannot determine the focus process, in order to avoid the focus process not being injected with the word extractor due to the inconsistency between the focus process and the main process of application 2, the state machine can inject the word library into each sub-process of application 2 respectively, so that all processes of application 2 are injected with the word library, ensuring that the focus process is injected with the word library.
[0164] It should be understood that, generally speaking, an application has at least one process, among which there is a main process, and the remaining processes are child processes, and the main process is also the parent process of the child processes. For example, the processes of application 1 include process a, process b, and process c. Process a is the main process, and process b and process c are child processes, and process a is also the parent process of process b and process c.
[0165] In addition, the purpose of injecting the word library into the process of application 2 is to make the process of application 2 load the word library to change the original business logic of application 2.
[0166] In some embodiments, the process of determining the child process of the above application 2 may include: first, the state machine may traverse all processes in the PC. Then, for each process among all the traversed processes, the state machine determines that the parent process of the process is the main process state machine of application 2, and then the process is a child process of application 2.
[0167] Specifically, for each process in all the processes in the traversed PC, the state machine can obtain the parent process ID of the process. Afterwards, since the state machine can directly obtain the main process ID of application 2, the state machine can determine whether the parent process ID of the process is the main process ID of application 2.
[0168] When the parent process identifier of the process is the main process identifier of application 2, it indicates that the parent process of the process is the main process of application 2, and the state machine can determine that the process is a child process of application 2. When the parent process identifier of the child process is not the main process identifier of application 2, it indicates that the parent process of the child process is not the main process of application 2, and the state machine can determine that the child process is not a child process of application 2, thereby achieving the determination of the child process of application 2.
[0169] Exemplarily, the process of determining the main process identifier (such as ID) of the above application 2 may include: the state machine may call the GetForegroundWindow() function to determine the main process of the application to which the focus window belongs, such as the main process identifier of application 2.
[0170] The process of determining the sub-process identifier of the above application 2 may include: first, the state machine may call the CreateToolhelp32Snapshot() function to determine all processes running on the PC and implement traversal of the processes on the PC.
[0171] After traversing to obtain the first process, the state machine can obtain detailed information of the first process (such as the ID of the first process, the ID of the parent process, etc.). If the ID of the parent process of the first process is the ID of the main process of application 2, it indicates that the first process is a child process of application 2, and the state machine can continue to determine whether the next process obtained by traversing is a child process of application 2. The code implementation of this process can be: Process32First if (pe32.th32ParentProcessID == processID) Process32Next. Among them, processID represents the ID of the main process of application 2, and pe32.th32ParentProcessID represents the ID of the parent process of the first process. The Process32First function is used to obtain detailed information of the first process. Process32Next is used to obtain detailed information of the next process.
[0172] In addition, for each process obtained by traversal, if the process does not have a parent process, it indicates that the process itself is the parent process, not the child process, and thus the process is not a child process of application 2.
[0173] In some embodiments, the state machine can use an injector to inject the word library into the main process of application 2 and each sub-process of application 2. Exemplarily, the injector can be an executable file (exe file). For example, the injector is MagicTextInjector.exe, which has a 32-bit version and a 64-bit version. Different versions of PCs can install corresponding versions of injectors so that the injector can run normally and stably on the PC. For example, a 32-bit PC can install a 32-bit version of the injector, and a 64-bit PC can install a 64-bit version of the injector.
[0174] In some embodiments, the above-mentioned word library can be a dynamic link library (dll) file, such as the word library can be MagicTextExtrator.dll. Of course, the word library can also be other types of files, such as exe, but no matter what type of file the word library is, its essence is a binary data module (or program mode). The word library also corresponds to a 32-bit version and a 64-bit version. Different versions of PCs can install corresponding versions of the word library, so that the word library can run normally and stably on the PC. For example, a 32-bit PC can install a 32-bit version of the word library, and a 64-bit PC can install a 64-bit version of the word library.
[0175] It can be understood that the 32-bit of PC means that the maximum number of bits that the processor (such as CPU) in the PC can process at one time is 32 bits. Similarly, the 64-bit of PC means that the maximum number of bits that the processor in the PC can process at one time is 64 bits.
[0176] Among them, optionally, for each process of application 2, the injector can use the two functions CreateRemoteThread() and WriteProcessMemory() to inject the lexicon library into the process. Among them, the WriteProcessMemory() function is used to write data (such as the path of the lexicon library) into the memory space of a specified process (such as the process of application 2). The CreateRemoteThread() function is used to create a remote thread in the memory space of the specified process, and the remote thread can use the path of the lexicon library to inject the lexicon library into the specified process. Specifically, the remote thread can call the LoadLibrary() function with the path of the lexicon library as a parameter, thereby injecting the lexicon library into the process of application 2.
[0177] The memory space for writing the data (such as the path of the word library) is accessible, otherwise, the reading of the path of the word library will fail, resulting in the failure of injecting the word library.
[0178] It should be noted that the functions used in the injection process described above (such as CreateRemoteThread(), WriteProcessMemory() and LoadLibrary()) are only examples, and other functions required to implement remote injection may also be used, which is not limited by this application.
[0179] In the embodiment of the present application, in order to ensure that the focus process of application 2 can be successfully injected into the word library, application 1 can inject the word library into each process of application 2 respectively, so that the main process and each sub-process of application 2 are injected with the word library, regardless of whether the focus process is the main process of application 2, so that the focus process is injected with the word library, ensuring that the word library can successfully send the selected text to application 1, so that application 1 can successfully obtain the selected text, thereby ensuring that the word retrieval function can be used normally.
[0180] In some embodiments, application 1 may inject the word library into all processes of application 2 multiple times. For example, a user uses a mouse to mark words multiple times in the window of application 2 (such as the window to which the first text belongs). For each of the multiple word markings, the OS sends a left mouse button press event to application 1. Afterwards, application 1 injects a word library into all processes of application 2 in response to the left mouse button press event. Although the process of application 2 may be injected with the word library multiple times, due to the OS's own mechanism, the process of application 2 will only load one word library instead of multiple word libraries, thereby avoiding repeated loading of word libraries.
[0181] In other embodiments, in order to prevent resource waste caused by multiple injections of the word library, before application 1 injects the word library into the process of application 2, it can first determine whether the word library has been injected into application 2, that is, determine whether application 2 has been injected with the word library. In the case that application 1 has injected the word library into application 2, it indicates that application 2 has been injected with the word library, and there is no need to inject the word library into application 2 again, thereby avoiding repeated injection of the word library and thus avoiding unnecessary injection of the word library.
[0182] Among them, a possible implementation process of the above-mentioned determination whether the application 2 is injected with the word library may include: after receiving the left mouse button press event, the application 1 injects the word library into the application 2 once, and writes the injection mark corresponding to the application 2 at the preset position, and the injection mark indicates that the word library has been injected into the process of the application 2. Among them, the application 1 writes the injection mark corresponding to the application 2 at the preset position only when it is determined that there is no injection mark corresponding to the application 2, that is, when the application 2 has not been injected with the word library, to indicate that the process of the application 2 has been injected with the word library.
[0183] When application 1 receives the left mouse button press event, application 1 determines that the application to which the focus window belongs is still application 2. Application 1 can determine whether there is an injection identifier corresponding to application 2 at the preset position. If it is determined that there is an injection identifier corresponding to application 2 at the preset position, application 1 does not need to inject the word library into the process of application 2 again.
[0184] When it is determined that there is no injection mark corresponding to application 2 at the preset location, it indicates that the process of application 2 has not been injected with the word library, and application 1 can inject the word library into the process of application 2.
[0185] Among them, optionally, the above-mentioned preset location can be a memory, a disk or other location where data can be written, and this application is not limited thereto.
[0186] It should be noted that the above-mentioned injection of the word library into the process of application 2 in response to the left mouse button pressing event is only an example. Application 1 can also inject the word library into the process of application 2 at other times after startup, and this application does not limit it.
[0187] In the embodiment of the present application, after receiving a left mouse button press event, application 1 can inject a word library into all processes of the application to which the focus window belongs. When a user presses the left mouse button multiple times in a window of an application, such as after the user finishes marking a word with the mouse, he uses the mouse to mark a word again, application 1 receives the left mouse button press event multiple times, thereby injecting the word library into the process of the application multiple times, resulting in multiple injections of the word library. However, due to the limitations of the OS, when the process of the application is running, only one word library will be loaded, so that the word library can still run normally, and there is no need for application 1 to determine whether the word library has been injected into the process of application 2, which simplifies the business processing logic, thereby simplifying the program code and reducing the amount of PC calculations.
[0188] S9. In response to the user's operation of moving the mouse, the OS sends a mouse movement event to the first subprocess, wherein the left button of the mouse is in a pressed state.
[0189] The above mouse movement event may be a mousemove event.
[0190] S10. In response to a mouse movement event, the first subprocess sets the text passed by the mouse cursor to a selected state.
[0191] In the embodiment of the present application, the mouse movement event may include the position information of the cursor. The left mouse button is pressed and the mouse is dragged, indicating that the user is using the mouse to mark a word, and the OS may send a mouse movement event to the first subprocess of application 2. After receiving the mouse movement event, the first subprocess uses the position information of the cursor in the mouse movement event to determine the text that the mouse cursor passes by, and the text that the mouse cursor passes by is the selected text, so that the first subprocess can set the text that the mouse cursor passes by to the selected state, such as highlighting the selected text, to achieve the effect of text selection.
[0192] In some embodiments, since application 1 registers to listen for mouse events, the OS can also send mouse movement events to application 1 (such as the event monitor in application 1). The event monitor in application 1 receives the mouse movement event. Afterwards, the event monitor sends the mouse movement event to the state machine. After receiving the mouse movement event, the state machine obtains the identifier of the main process of the application to which the focus window belongs (or the main process corresponding to the current focus window). Afterwards, the state machine can determine whether the main process identifier corresponding to the current focus window is the main process identifier of application 2, that is, determine whether the focus is still in the window of application 2, in other words, determine whether the mouse cursor has moved to the window of another application.
[0193] The main process identifier corresponding to the current focus window is not the main process identifier of application 2, indicating that the focus is no longer in the window of application 2, but in the window of another application. Since text in windows of multiple applications cannot be selected at the same time, application 1 does not need to obtain the selected text. Therefore, after receiving the left mouse button release event, application 1 does not need to send the first copy command to application 2 through the OS, that is, application 1 does not need to execute S15 described below, thereby avoiding unnecessary acquisition of selected content.
[0194] Optionally, before sending the mouse movement event to the state machine, the event monitor may first determine whether the mouse movement event belongs to a preset event. If it belongs to a preset event, the event monitor may send the mouse movement event to the state machine. If it does not belong to a preset event, the event monitor does not need to send the mouse movement event to the state machine.
[0195] It should be noted that if the state machine does not receive a left mouse button press event before receiving the above-mentioned mouse move event, indicating that the user did not press the left mouse button before moving the mouse, then the state machine may not respond to the mouse move event, and there is no need to send the first copy command.
[0196] S11. In response to the user releasing the left button of the mouse, the OS sends a left button release event to the event monitor and the first child process.
[0197] In the embodiment of the present application, when the user wants to stop selecting text, the user can release the left mouse button. Since both application 1 and application 2 register to monitor mouse events, the OS can send a left mouse button release event to the event monitor of application 1 and the focus process of application 2 in response to the user's release operation of the left mouse button.
[0198] Exemplarily, the above-mentioned left mouse button release event may be a mouseup event.
[0199] S12: In response to the left mouse button release event, the first subprocess does not display the default menu of application 2 based on the word library.
[0200] For example, generally speaking, after receiving the left mouse button release event, indicating that the mouse word selection is completed, the first sub-process needs to display a default menu on the first text. However, since the first sub-process is injected with the word retrieval library, the word retrieval library can intercept the first sub-process from displaying the default menu.
[0201] In some embodiments, if application 1 exits, after the mouse click ends, the first sub-process can still display the default menu of application 2 normally (as shown below). Fig. 10C For example, application 1 is a text application. After the text application is started, the user clicks the mouse to Fig. 10A The second control 51 of the text application on the sidebar is shown. In response to the user's click operation on the second control 51 of the text application, the PC stops running the text application, and the second control 51 of the text application on the sidebar is switched to an unselected state (eg, Fig. 10B The second control 53 of the text application shown in FIG. 1 is not displayed on the interface displayed by the PC. Fig. 10A The second control 50 of the text application is shown located in the lower right corner of the interface.
[0202] Afterwards, when the user presses the left button of the mouse on the first text and moves the mouse, the focus process corresponding to the focus window to which the first text belongs can select the text over which the mouse passes. Afterwards, the user releases the left button of the mouse, and the focus process responds to the left button release event and displays the following Fig. 10C The default menu 54 shown, in simple terms, means that when the application 1 on the PC is not running, the application 2 can respond normally to the user's mouse operation according to its own business logic.
[0203] The above-described method of exiting the text application through the second control of the text application on the sidebar is only an example, and other methods can also be used to exit the text application. For example, the user presses the right button of the mouse to click on the above Fig. 10AAs shown, the second control 50 of the text application located at the lower right corner of the interface, in response to a right-click operation on the second control 50 of the text application, the PC can display an exit control, which is used to trigger the PC to stop running the text application.
[0204] S13. The event monitor sends a mouse left button release event to the state machine.
[0205] In some embodiments, after receiving the left mouse button release event, the event monitor can determine whether the left mouse button release event belongs to a preset event, that is, determine whether the state machine needs to process the left mouse button release event. In the case where the left mouse button release event belongs to a preset event, the event monitor can send the left mouse button release event to the state machine. In the case where the left mouse button release event does not belong to a preset event, it indicates that the state machine does not need to process the left mouse button release event, and the event monitor does not need to send the left mouse button release event to the state machine.
[0206] S14. The state machine sends a first copy command to the OS in response to the left mouse button release event.
[0207] The first copy command may be a Ctrl+C command.
[0208] S15. The OS sends a first copy command to the first child process.
[0209] S16. The first subprocess responds to the first copy command and stops adding the selected text to the clipboard based on the word library.
[0210] S17. The first subprocess sends the selected text to application 1 based on the word library.
[0211] In the embodiment of the present application, after the state machine receives the left mouse button release event, it indicates that the mouse word drawing is completed, and application 1 needs to obtain the text selected by the mouse, that is, the selected text. Since the state machine cannot directly determine the focus process, but the OS can determine the focus process, the state machine can first send a first copy command to the OS, and the first copy command is used to trigger application 2 to send the selected text to application 1 (or the main process of application 1). Afterwards, the OS receives the first copy command. Afterwards, the OS can send the first copy command to the focus process, that is, to the first child process of application 2.
[0212] Generally speaking, after receiving the first copy command, the first child process will call the clipboard data write function to write the selected text to the clipboard. However, in order to prevent data leakage, when it is detected that the first child process calls the clipboard data write function, the first child process can intercept the selected text based on the word library to stop writing the selected text to the clipboard, thereby ensuring the security of the selected text, so that the selected text will not exist in the clipboard, and user data leakage is avoided. And in order for application 1 to still obtain the selected text, the first child process needs to use the word library to send the selected text to application 1 (or the main process of application 1), so that application 1 can successfully obtain the text selected by the user and successfully obtain the text selected by the mouse, thereby avoiding the situation where application 2 fails to retrieve words due to inconsistency between the focus process and the main process of application 2.
[0213] Optionally, a hook function may be used to detect whether a clipboard data writing function is called, and the clipboard data writing function may be a function provided by the OS.
[0214] In some embodiments, the word library may not intercept the clipboard writing data function, that is, the first child process may write the selected text to the clipboard in response to the first copy command, without executing the above S16. Afterwards, application 1 can read the selected text from the clipboard to achieve successful acquisition of the selected text without the need for the first child process to send it, that is, application 2 may not execute the above S17. Exemplarily, after sending the first copy command, the state machine of application 1 can read the selected text from the clipboard. Of course, other processes or threads of application 1 can also read the selected text from the clipboard, such as the main process of application 1 can read the selected text from the clipboard.
[0215] S18. Application 1 sends the selected text to the service process.
[0216] For example, since the first sub-process can determine the main process of application 1, the first sub-process can send the selected text to the main process of application 1 based on the word library. The main process of application 1 sends the selected text to the service process.
[0217] In some embodiments, after receiving the left mouse button release event, the state machine of application 1 (or the state machine in application 1) obtains the position of the mouse cursor from the left mouse button release event to obtain the end position. Similarly, the state machine can obtain the position of the mouse cursor (or simply the mouse) from the left mouse button press event to obtain the start position. Afterwards, the state machine determines that the end position is the same as the start position, indicating that the mouse cursor has not moved or the mouse cursor has returned to the start position after moving, which means that the user has not selected any text, and the state machine does not need to obtain the selected text, so there is no need to send the first copy command to application 2, avoiding unnecessary acquisition of the selected text.
[0218] For example, after receiving the left mouse button release event, application 1 (or the state machine in application 1) can determine whether the end position is the same as the start position. If the end position is the same as the start position, the state machine does not send the first copy command to application 2, and application 2 can respond to mouse events (such as the left mouse button release event) normally according to its own business logic. If the end position is different from the start position, it indicates that the cursor has moved and the user may have selected text. Therefore, the state machine can continue to send the first copy command to application 2 to obtain the selected text from application 2.
[0219] The above describes the process of judging whether the mouse cursor moves after the left mouse button is pressed by the position in the left mouse button press event and the left mouse button release event. It is also possible to judge whether the mouse cursor moves by other methods. The following will continue to introduce another method of judging whether the mouse cursor moves.
[0220] After application 1 (such as the state machine in application 1) receives a left mouse button release event, if no mouse move event has been received before, that is, if the state machine has not received a mouse move event from the time the left mouse button is pressed to the time the left mouse button is released, the state machine can determine that the mouse has not moved, which means that the user has not selected any text, and the state machine does not need to obtain the selected text, thereby eliminating the need to send the first copy command to application 2, thereby avoiding unnecessary acquisition of the selected text.
[0221] If the state machine receives a mouse move event from the time it receives the left mouse button pressed event to the time it receives the left mouse button released event, the state machine can determine that the mouse has moved and the mouse may have selected text. The state machine needs to obtain the selected text. Therefore, the state machine can continue to send the first copy command to application 2 to obtain the selected text from application 2.
[0222] Specifically, a mouse event has a corresponding timestamp, and the timestamp indicates the time when the mouse event occurs. The state machine can determine whether there is a mouse movement event whose timestamp is within the target time period. Among them, the start time of the target time period is the time when the left mouse button is pressed, that is, the time when the user presses the left mouse button. In other words, the start time can indicate the timestamp corresponding to the left mouse button pressed event. The end time of the target time period indicates the time when the left mouse button is released, that is, the time when the user releases the left mouse button. In other words, the end time can indicate the timestamp corresponding to the left mouse button released event.
[0223] In the case where there is a mouse movement event whose timestamp is within the target period, it indicates that the user moved the mouse between when the user pressed the left mouse button and when the user released the left mouse button, and the state machine can determine that the mouse moved.
[0224] In the absence of a mouse movement event whose timestamp is within the target period, it indicates that the user did not move the mouse between pressing the left mouse button and releasing the left mouse button, and the state machine can determine that the mouse has moved.
[0225] In the embodiment of the present application, after the focus process of application 2 (such as the first sub-process mentioned above) receives the left mouse button release event, if the first copy command is not received, it indicates that application 1 does not need to retrieve words, and the first sub-process can respond to the left mouse button release event normally. If the first copy command is received, it indicates that application 1 needs to retrieve words, and the first sub-process can respond to the first copy command, and send the selected text to application 1 based on the word retrieval library, without responding to the left mouse button release event according to its own business logic to display the default menu, so as to ensure that the word retrieval function of application 1 can be used normally, thereby ensuring the stability of application 1 operation, and application 2 can avoid menu display conflicts by not responding to the left mouse button release event, avoiding users' doubts about why the PC displays multiple menus, and ensuring the user experience.
[0226] S19: In response to the selected text, the service process displays a first menu of application 1 on the PC, wherein the first menu includes at least one function control, wherein each function control in the at least one function control is used to trigger the PC to perform corresponding processing on the selected text.
[0227] Exemplarily, the above functional controls may be copy controls, translation controls, search controls, jump controls, read controls, or save controls to a note application, etc. For example, the tablet computer displays the above Figure 2F The menu 10 shown, the first menu 10 includes several functional controls: copy control, translation control, search control, jump control, read aloud control, and save to note application.
[0228] It should be understood that the functional controls listed above are only examples, and the functional controls may also be other types of controls, as long as they can trigger the PC to process text, and this application does not limit them.
[0229] It should be noted that the above application 1 sending the selected text to the service process so that the service process triggers the PC to display the first menu is only an example process. The first menu can also be triggered and displayed by other applications. For example, after receiving the selected text, application 1 can directly display the first menu on the PC display screen. After receiving the user's selection operation (such as a click operation) of the target function control in the first menu, application 1 can respond to the selection operation of the target function control and perform corresponding processing on the selected text. For example, if the user selects the copy control in the first menu, application 1 can write the selected text to the clipboard in response to the copy function.
[0230] The above describes the situation where the first child process can obtain the text. There is also the possibility that the first child process cannot obtain the selected text. The following will continue to introduce the situation where the first child process cannot obtain the selected text.
[0231] The mouse cursor is located in the non-framed text area, and the left mouse button is pressed. The text in the non-framed text area cannot be edited, that is, it cannot be selected. The OS sends a left mouse button press event to application 1 and application 3 to which the non-framed text area belongs. Afterwards, the event monitor in application 1 sends the left mouse button press event to the state machine after receiving the left mouse button press event. The state machine injects the word library into all processes of application 3. Afterwards, the mouse is moved, and the OS sends the mouse move event to application 3 and application 1 respectively. Afterwards, the left mouse button is released, and the OS sends the left mouse button release event to application 1 and application 3 respectively. Afterwards, the event monitor sends the left mouse button release event to the state machine after receiving the left mouse button release event. Afterwards, the state machine sends a first copy command to application 3 in response to the left mouse button release event. Since the text in the non-framed text area cannot be selected, the focus process of application 3 cannot obtain the content selected by the user, so that application 1 cannot obtain the content selected by the user, and application 1 does not need to trigger the PC to display the corresponding first menu.
[0232] It should be understood that the sub-processes (such as the first sub-process and the second sub-process) included in the process of application 2 described above are only examples, and application 2 may not include the second sub-process, or may include more sub-processes. In addition, the operations performed by the main process, state machine, and event monitor of application 1 described above are only examples, and the operations performed by the main process, state machine, and event monitor of application 1 may also be performed by other processes or threads of application 1, as long as they are performed by application 1, that is, by the processes or threads of application 1.
[0233] Similarly, the operations performed by the above-mentioned application 1, application 2 and service process are actually executed by the processor of the PC. Therefore, the operations performed by application 1, application 2 and service process can be considered to be executed by the PC.
[0234] In the embodiment of the present application, it is taken as an example that application 1 is a text application and application 2 is an office application. Fig.11 As shown, after receiving the left mouse button press event, the state machine can use the injector to execute step C1 and inject the word library into all processes of the office application, so that each process of the office application can be injected with the word library, ensuring that the text application can successfully retrieve words. Afterwards, after the left mouse button is pressed, the state machine can send a first copy command to the office application (such as sending a first copy command to the focus process of the office application through the OS). Afterwards, after the focus process of the office application receives the first copy command, since the first copy command is sent by the office application, rather than triggered by the user clicking the copy control, in order to protect user privacy, the focus process of the office application can execute step I and stop writing the selected text to the clipboard to prevent other users from discovering the user's selected text through the clipboard, thereby improving the user experience.
[0235] Among them, the above Fig.11 The steps A, B, D, E, F, G and H shown can be referred to the above description and will not be repeated here.
[0236] It should be understood that if the above-mentioned focus process is a sub-process of application 2 (such as the first sub-process) is only an example, and the focus process can also be the main process of application 2. When the focus process is the main process of application 2, application 1 can also inject the vocabulary library into all processes of application 2.
[0237] In some embodiments, in the case described above where the text application is started first and then the first text is opened, the first text may be opened first, and the first text is a selectable text. If application 1 is not started, even if the text in the first text is selected by the mouse, the PC does not display the first menu, so application 1 needs to be started. After application 1 is started, the first menu may be displayed after the text in the selectable text is selected. Specifically, at the first time, the PC starts application 2. Between the first time and the second time, the program modules loaded by the main process of application 2 and each subprocess of application 2 do not include the first program module (i.e., the above-mentioned word library), and the second time is after the first time. The PC displays the first window of application 2, and the first window includes the first text. After the text in the first text is selected in the first window, the first menu is not displayed. Afterwards, at the second time, application 1 is started. After the second time, the program modules loaded by the main process of application 2 and each of the multiple subprocesses include the word library, indicating that each process of application 2 is injected with the word library. Correspondingly, after the text in the first text is selected in the first window, that is, after the left mouse button is released, the PC can display the first menu, so that application 1 can be used normally.
[0238] The above-mentioned selection of the text in the first text in the first window can be understood as selecting the text in the first text, that is, selecting the text in the first text. In other words, selection refers to the process of the user pressing the left mouse button, moving the mouse, and releasing the left mouse button.
[0239] The process of injecting the word library into the process of application 2 can be referred to in the above description, such as the description corresponding to S5-S8. The process of displaying the first menu on the PC can be referred to in the above description, such as the description corresponding to S11-S19, which will not be repeated here.
[0240] In addition, during the selection process, the PC can also perform corresponding processing based on the mouse movement event. The description of this process can also be found in the above description, such as the description corresponding to the above S9-S10.
[0241] In some embodiments, the present application provides a computer-readable storage medium, including computer instructions, which, when executed on a Bluetooth device, enable the electronic device to execute the text processing method as described above.
[0242] In some embodiments, the present application provides a computer program product, which, when executed on a Bluetooth device, enables the electronic device to execute the text processing method as described above.
[0243] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0244] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0245] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0246] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0247] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0248] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A text processing method, characterized in that: include: At a first time, a first application is started, the first application includes a plurality of sub-processes; between the first time and the second time, a main process of the first application and each of the plurality of sub-processes loads a program module that does not include the first program module; Displaying a first window of the first application, wherein the first window includes selectable text; After the text in the selectable text is framed in the first window, the first menu of the second application is not displayed; At the second time, starting the second application, the second time being later than the first time; After selecting the text in the selectable text in the first window, the first menu of the second application is displayed at a third time, after the third time, the main process of the first application and the program modules loaded by each sub-process include the first program module, and the third time is later than the second time; wherein, the first menu includes a function control, and the function control is used to process the selected text.
2. The method according to claim 1, characterized in that: The method further comprises: After the second application is started, the first program module is injected into the main process of the first application and each of the sub-processes respectively.
3. The method according to claim 2, characterized in that After the second application is started, injecting the first program module into the main process of the first application and each of the sub-processes respectively includes: After the second application is started, in response to a left mouse button press event, the first program module is injected into the main process of the first application and each of the sub-processes through the second application.
4. The method according to any one of claims 1 to 3, characterized in that Applied to the electronic device, after starting the second application, the method further includes: Determine the main process of the first application, and determine the child process of the first application based on the main process identifier of the first application and the parent process identifier of other processes, where the other processes include processes running on the electronic device other than the main process of the first application, and the parent process identifier of the child process of the first application is the same as the main process identifier of the first application.
5. The method according to any one of claims 1 to 3, characterized in that After selecting the text in the selectable text in the first window, displaying the first menu of the second application includes: After selecting the characters in the selectable text in the first window, the first program module is called to display the first menu.
6. The method according to claim 5, characterized in that Applied to an electronic device, the calling of the first program module and displaying the first menu include: In response to a left mouse button release event, based on the operating system of the electronic device, sending a first copy command to the child process corresponding to the first window; After obtaining the selected text, the first menu is displayed; wherein the selected text is sent by the subprocess corresponding to the first window in response to the first copy command and calling the first program module.
7. The method according to any one of claims 1 to 3, characterized in that After the text in the selectable text is framed in the first window, the selected text is not displayed on the clipboard.
8. The method according to claim 7, characterized in that The method further comprises: After selecting the text in the selectable text in the first window, the first program module is called to not display the selected text on the clipboard.
9. The method according to claim 1, characterized in that: After the second application is started, the method further includes: In response to a mouse move event, determining a focus window; In a case where the focus window is different from the first window, in response to a left mouse button release event, the first menu is not displayed.
10. The method according to claim 1, characterized in that After the second application is started, the method further includes: In response to a left mouse button release event, the end position of the mouse is determined to be the same as the start position of the mouse, and the first menu is not displayed; the start position of the mouse represents the position of the mouse cursor when the left mouse button is pressed; the end position of the mouse represents the position of the mouse cursor when the left mouse button is released.
11. The method according to claim 1, characterized in that: After the second application is started, the method further includes: In response to a left mouse button release event, it is determined that there is no mouse movement event within a target time period, and the first menu is not displayed; wherein the target time period represents from when the left mouse button is pressed to when the left mouse button is released.
12. An electronic device, characterized in that: The electronic device includes a display screen, a memory and one or more processors; the display screen, the memory and the processor are coupled; the display screen is used to display an image generated by the processor, and the memory is used to store computer program code, and the computer program code includes computer instructions; when the processor executes the computer instructions, the electronic device executes the method described in any one of claims 1 to 11.
13. A computer-readable storage medium, characterized in that: The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method as claimed in any one of claims 1 to 11.
Citation Information
Patent Citations
Operating system launch menu program listing
AU2014202461A1
Text processing method and mobile terminal
CN108415652A
Text processing method and device, electronic equipment and storage medium
CN112115947A
Information processing method and device and device for information processing
CN112667124A
Information reading method, intelligent terminal and storage medium
CN115494997A
