Disclosure of Invention
The technical problem to be solved by the application is to provide a multi-process management method and device to solve the problem that unified control and management among multiple processes of different applications cannot be realized by the existing setting key such as a boss key.
In order to solve the above problem, the present application discloses a multiprocess management method, including: the current process receives an input instruction of setting a key, and a window operated by the current process is displayed or hidden according to the instruction; the current process informs other processes according to the instruction, so that the other processes display or hide the windows operated by the other processes; wherein the current process and the other processes are processes of a plurality of applications that satisfy a set rule.
Preferably, before the step of receiving the input instruction of setting the key by the current process, the method further includes: one process in the plurality of application processes receives a setting instruction; the process receiving the setting instruction notifies the setting instruction to all processes except for the process itself among the processes of the plurality of applications; the setting instruction comprises information of the setting key, and the setting instruction is used for indicating a process receiving the input instruction of the setting key to display or hide an operating window of the process.
Preferably, each process of the plurality of application processes is provided with an inter-process communication manager, and the inter-process communication manager is configured to store and manage process information of the plurality of application processes through a mapping table, where the process information includes information of a process identifier and a main window handle.
Preferably, before the step of receiving the setting instruction by one of the processes of the plurality of applications, the method further includes: when a process is started in the processes of the plurality of applications, the newly started process sends a registration message to the started process; the started process acquires the information of the newly started process through the registration message and stores the information into an inter-process communication manager of the started process; the started process sends a response message to the newly started process, wherein the response message carries process information in an interprocess communication manager of the started process; and the newly started process acquires the process information in the inter-process communication manager of the started process and stores the process information in the inter-process communication manager of the newly started process.
Preferably, the started process is the process where the top-level window is located; or the started processes comprise a plurality of processes, and the process, which receives the registration message, in the plurality of started processes acquires the information of the newly started process through the registration message and sends a response message to the newly started process.
Preferably, the step of the current process notifying other processes according to the instruction comprises: the current process acquires the process information of the other processes stored in the inter-process communication manager of the current process; and notifying the other processes of the instruction according to the process information of the other processes.
Preferably, the plurality of applications satisfying the set rule are a plurality of applications running simultaneously using the same browser.
Preferably, the plurality of applications satisfying the set rule are a plurality of games launched in one browser using a game plug-in.
In order to solve the above problem, the present application further discloses a multiprocess management apparatus, including: the first receiving module is used for enabling the current process to receive an input instruction of a setting key and displaying or hiding a window operated by the current process according to the instruction; the first notification module is used for enabling the current process to notify other processes according to the instruction, and enabling the other processes to display or hide windows operated by the other processes; wherein the current process and the other processes are processes of a plurality of applications that satisfy a set rule.
Preferably, the multi-process management apparatus further includes: a second receiving module, configured to receive a setting instruction through one of the multiple application processes before the first receiving module enables the current process to receive the input instruction of the setting key; a second notifying module configured to cause the process that has received the setting instruction to notify all of the processes of the plurality of applications except for itself of the setting instruction; the setting instruction comprises information of the setting key, and the setting instruction is used for indicating a process receiving the input instruction of the setting key to display or hide an operating window of the process.
Preferably, each process of the plurality of application processes is provided with an inter-process communication manager, and the inter-process communication manager is configured to store and manage process information of the plurality of application processes through a mapping table, where the process information includes information of a process identifier and a main window handle.
Preferably, the multi-process management apparatus further includes: the registration module is used for sending a registration message to a started process by a newly started process when the process is started in the processes of the plurality of applications before the second receiving module receives a setting instruction through one process in the processes of the plurality of applications; a first obtaining module, configured to enable the started process to obtain information of the newly started process through the registration message, and store the information in an inter-process communication manager of the started process; a reply module, configured to enable the started process to send a response message to the newly started process, where the response message carries process information in an inter-process communication manager of the started process; and the second acquisition module is used for enabling the newly started process to acquire the process information in the inter-process communication manager of the started process and storing the process information in the inter-process communication manager of the newly started process.
Preferably, the started process is the process where the top-level window is located; or the started processes comprise a plurality of processes, and the process, which receives the registration message, in the plurality of started processes acquires the information of the newly started process through the registration message and sends a response message to the newly started process.
Preferably, the first notification module is configured to enable the current process to obtain process information of the other processes stored in the inter-process communication manager of the current process; and according to the process information of the other processes, notifying the other processes of the instruction, and enabling the other processes to display or hide the windows operated by the other processes.
Preferably, the plurality of applications satisfying the set rule are a plurality of applications running simultaneously using the same browser.
Preferably, the plurality of applications satisfying the set rule are a plurality of games launched in one browser using a game plug-in.
Compared with the prior art, the method has the following advantages:
according to the application, different processes of a plurality of applications meeting a certain rule are mutually associated (for example, the processes of a plurality of games are mutually associated), when a current process receives an instruction of setting a key (for example, a tablet key), not only the window operated by the current process is displayed or hidden, but also other processes associated with the current process are notified to display or hide the windows operated by the current process, so that the windows of the plurality of applications are simultaneously displayed or hidden, the problem that the conventional function of setting the key cannot realize the unified control and management among the processes of different applications is solved, the function of setting the key is effectively improved, and the unified control and management of the setting key in a multi-process mode are realized.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, the present application is described in further detail with reference to the accompanying drawings and the detailed description.
Example one
Referring to fig. 1, a flowchart illustrating steps of a multi-process management method according to a first embodiment of the present application is shown.
The multi-process management method of the embodiment comprises the following steps:
step S102: and the current process receives an input instruction for setting the keys, and displays or hides the window operated by the current process according to the instruction.
Step S104: and the current process informs other processes according to the instruction, so that the other processes display or hide the windows operated by the other processes.
Wherein the current process and the other processes are processes of a plurality of applications satisfying the set rule. The setting rule may be flexibly set by a person skilled in the art according to actual situations, and is generally set to multiple applications of the same type or multiple applications opened using the same program, for example, to an application opened using the same browser, or to an application opened using the same plug-in, or to an application of the same type of application (for example, all applications are games or e-book applications), or to multiple browsers each capable of accepting an old board key, and the like, which is not limited in this application.
Preferably, the plurality of applications satisfying the set rule are a plurality of applications running simultaneously using the same browser, such as a plurality of games opened simultaneously in the same browser using a game plug-in.
For example, when a plurality of game windows are controlled and managed in a unified manner using the boss key function, the boss key function is a game auxiliary function built in the game plug-in, and the game plug-in runs the game in a separate process manner after opening the game. Therefore, it is possible to associate the processes of a plurality of games (satisfying the rule of opening using the game plug-in) with each other, manage and control the processes of these plurality of games associated with each other using the tablet key, and realize the unified control and management of a plurality of game windows. The association form may be various, for example, the association table is used to record information among a plurality of processes, and other processes are notified according to the information in the association table, but the present invention is not limited thereto, and any other suitable form may also be used in practical application, such as searching and acquiring information of related processes in real time, and notifying related processes according to the information acquired in real time.
In this embodiment, after the current game process receives an instruction of the tablet key pressed by the user, the game window operated by the current game process is displayed or hidden, and meanwhile, the message that the user presses the tablet key is received to notify other processes associated with the current game process, that is, other game processes operated, so as to instruct the other game processes to close the corresponding game windows.
It should be noted that the above is only an exemplary illustration, and it should be understood by those skilled in the art that the present embodiment may also be applied to other scenarios of multiple applications that satisfy a set rule, such as electronic book reading, and the present application is not limited thereto.
According to the embodiment, different processes of a plurality of applications meeting a certain rule are mutually associated, when a current process receives a command of setting a key, not only a self-running window is displayed or hidden, but also other processes associated with the current process are notified to display or hide respective running windows, so that the windows of the plurality of applications are simultaneously displayed or hidden, the problem that the conventional boss key function cannot realize the unified control and management among the processes of the different applications is solved, the function of the boss key is effectively improved, and the unified control and management of the boss key in a multi-process mode are realized. Of course, other scenarios of one-key management of multiple applications or multiple processes can be performed with reference to the present embodiment.
Example two
Referring to fig. 2, a flowchart illustrating steps of a multi-process management method according to a second embodiment of the present application is shown.
In this embodiment, a multi-process management method of the present application is described by taking an example of using a tablet key to control and manage a plurality of game processes opened by using a game plug-in a plurality of tab pages of one browser, but the present invention is not limited thereto, and other similar scenarios of using a hot key to control and manage a plurality of application processes can be performed with reference to this embodiment.
In this embodiment, the boss key function is a game auxiliary function built in the game plug-in, and the game window can be hidden or opened by one key. After the game is opened by using the game plug-in, the game is operated in a single process mode, so that a plurality of processes can be operated simultaneously when a plurality of games are opened, and a manager is needed for managing all the operated game processes. In this embodiment, a star-shaped manner is used for managing running game processes, when a plurality of game processes are opened by using a game plug-in, each process sends a registration message to the top-level window after being started, and after all other opened game processes except the game process in which the top-level window is located receive the registration message, the IPC manager (inter-process communication manager) of the process is updated, a response message is sent to the process sending the message, and the current existing process is carried, so that all the processes are connected. When a user sets a boss key in a certain process, the process calls an API (application program interface) to register the boss key and simultaneously sends other processes to inform the boss key value set by the current user. When the user presses the boss key, the process registering the boss key first responds, and the process informs all other processes to forcibly display or hide the window after processing.
Specifically, the multi-process management method of the embodiment includes the following steps:
step S202: when a process is started in the processes of the plurality of applications, the newly started process sends a registration message to the started process.
In this embodiment, the plurality of applications are a plurality of games opened by using the game plug-in, and the started process is a process where a top-level window of the started game is located. When a new game is opened using the game plug-in, the progress of the game sends a registration message to the game progress of the top-level window. Of course, there may be more than one started process, and in this case, the newly started process may send a registration message to the started processes.
Step S204: and the started process acquires the information of the newly started process through the registration message and stores the information into the interprocess communication manager of the started process.
The system comprises a plurality of application processes, wherein each of the application processes is provided with an inter-process communication manager, and the inter-process communication managers are used for storing and managing process information of the application processes. Through the interprocess communication manager, the process information can be quickly acquired, the process state can be determined, and the multi-process management efficiency can be improved.
In this embodiment, the game process of the top window acquires the process information of the new game and stores the process information in the inter-process communication manager, and if there is no other game process, the game process of the top window stores the process information of the new game process and the game process itself.
If the started processes are multiple, the process which receives the registration message of the newly started process firstly acquires the process information of the started process, stores the information to the inter-process communication manager of the process, and simultaneously informs other started processes to update the information in the inter-process communication manager of the process so as to synchronize the information in the inter-process communication managers of all the started processes.
Step S206: the started process sends a response message to the newly started process.
Wherein, the response message carries the process information in the inter-process communication manager of the started process.
In this embodiment, the game process of the top-level window sends a response message to the new game process, where the response message carries the game process of the top-level window and the process information of the new game process.
If the number of the started processes is multiple, the process which receives the registration message of the newly started process firstly sends a response message to the starting process, wherein the response message carries the process information in the inter-process communication manager of the newly started process, and the newly started process acquires the process information and stores the process information in the inter-process communication manager of the starting process after receiving the message, so that the information synchronization between the newly started process and other started processes is realized. By notifying other processes by the process which receives the registration message firstly and sending the response message, the message processing efficiency is improved, the window display or hiding time is shortened, and the user experience is improved.
Of course, in practical applications, the process that receives the registration message first is not limited to notify other processes and send a response message, and those skilled in the art may determine the receiving and response mode of the registration message by using other appropriate policies according to practical situations, which is not limited in this application.
Step S208: and the newly started process acquires the process information in the inter-process communication manager of the started process and stores the process information in the inter-process communication manager of the newly started process.
In this embodiment, the new game process obtains the game process of the top-level window and the process information of the new game process carried in the response message, and stores the game process and the process information of the new game process in the interprocess communication manager of the new game process.
At this point, mutual association is established among the processes of the plurality of applications, and the process information of all the processes of the plurality of applications can be acquired through the inter-process communication manager of any one process.
Step S210: one of the processes of the plurality of applications receives the setting instruction.
Taking the tablet key as an example, a user may perform setting in any one of the processes of the plurality of applications, where the setting instruction includes information about the setting key (e.g., which keys the setting key includes), and the setting instruction is used to instruct the process receiving the input instruction about the setting key to display or hide a window in which the process is running (e.g., the current process receives an instruction about the tablet key pressed by the user, and displays or hides the window).
The set instruction is input through any process, so that the compatibility of multi-process management is improved, and the use experience of a user is improved.
Step S212: the process that receives the setting instruction notifies the setting instruction to all processes of the plurality of applications except for itself.
Once a process receives a setting instruction, which indicates that a user has performed a key setting (e.g., boss key setting), the process notifies other related processes, and notifies other processes of the key setting performed by the user, so that the key setting is effective for all related processes.
Step S214: and the current process receives an input instruction for setting the keys, and displays or hides the window operated by the current process according to the instruction.
When a user presses a set key, a current process (such as a currently running game process) receives an instruction, and a window running by the current process is displayed or hidden.
Step S216: and the current process acquires the process information of other processes stored in the interprocess communication manager of the current process.
Step S218: and the current process informs other processes of the instruction according to the process information of other processes, so that the other processes display or hide the windows operated by other processes.
The inter-process communication manager of the current process stores the process information of all related processes, when a user presses a setting key, the current process not only displays or hides the window operated by the current process, but also informs the related processes to display or hide the corresponding windows, thereby realizing the unified management or control of the setting key on a plurality of applications.
In this embodiment, the boss key function is a game auxiliary function built in the game plug-in, and all game windows can be hidden or opened by one key through the boss key function of this embodiment. In the embodiment, the boss key is set in one process, and all webpage game processes or Flash game processes can receive the boss key to hide or display a window, so that the unified control of the boss key in a multi-process mode is realized.
Compare with current boss key function: (1) in the embodiment, the user sets the boss key once, which is effective for all processes, so that the times set by the user are reduced, and the user experience is improved; (2) compared with the traditional single-process setting of the boss key, the process sets the condition that other processes are not set, avoids the problem that the boss key function is invalid after the single-process boss key is withdrawn, and greatly improves the boss key function; (3) the setting windows of the boss keys in all the process windows can use a uniform interface, and the process information of each process can be synchronized, so that the user can conveniently set the boss keys.
EXAMPLE III
Referring to fig. 3, a flowchart illustrating steps of a multi-process management method according to a third embodiment of the present application is shown.
The multi-process management method of the embodiment comprises the following steps:
step S302: and displaying a boss key window and receiving an instruction of setting the boss key by a user.
In this step, the boss key window may be displayed by any one of the plurality of applications that satisfy the setting rule for the user to set.
Step S304: register the boss key.
In this step, after the user sets the boss key in a process of an application, the process calls the API to register the boss key, and simultaneously sends other related processes in the plurality of applications to notify the boss key value set by the current user.
Before step S302 or after step S304, a new process of the application satisfying the setting rule may be started, and when the process is started, a registration message is sent to the started process. When a started process receives a registration message sent by a certain process, the message carries information of a process identifier and a main window handle, such as a game ID, an account ID, a created main window handle and the like, and the process receiving the registration message can be stored in an IPC manager of the current process as a unique key according to a combination (process identifier) of the game ID and the account ID. Preferably, the IPC manager may use a map table (mapping table) to hold and manage process information of processes of a plurality of applications.
When a process receives a registration message of a certain process, it indicates that a new process is started, but the newly started process does not know how many processes are started at this time, so that after receiving the registration message of the newly started process, which process receives the registration message of the newly started process first, the process can respond to the message preferentially, and the process carries how many processes are currently and the specific information of each process, and the specific information can also be the information of process identifiers such as game IDs, account IDs, created main window handles and the like and the main window handles, so that the newly started process can know the information of other processes for subsequent processing. The process information of other processes stored by one process can be stored through the map table, and further can be transmitted to other processes through the memory mapping file.
After the connection is established among the multiple processes of the multiple applications, the setting and registration of the boss key can be known by each process, so that the subsequent boss key can uniformly control and manage the multiple processes.
Step S306: the current process receives an instruction of pressing the boss key by the user.
Step S308: the current process hides or displays the window it runs.
Step S310: the current process notifies the other processes of the instruction of the user to press the boss key in the form of a message.
When the current process notifies other processes, the process information of other processes is obtained according to the map table stored by the current process, and then the related processes are notified according to the process information.
Step S312: and other processes receive the boss key message sent by the current process.
Step S314: other processes hide or display the corresponding window.
And after receiving the message sent by the current process, other processes hide or display the corresponding windows respectively.
Through this embodiment, realized setting up the boss key in the process of an application, carried out unified control and management to a plurality of processes of a plurality of applications, solved current boss key function, can't realize the problem of unified control and management between the multiprocess of different applications, effectively improved the function of boss key, realized the unified control and the management of boss key under the multiprocess mode.
Example four
Referring to fig. 4, a block diagram of a multi-process management apparatus according to a fourth embodiment of the present application is shown.
The multiprocess management device of the embodiment comprises: a first receiving module 402, configured to enable a current process to receive an input instruction for setting a key, and display or hide a window in which the current process operates according to the instruction; a first notification module 404, configured to enable the current process to notify other processes according to the instruction, so that the other processes display or hide windows in which the other processes operate; wherein the current process and the other processes are processes of a plurality of applications satisfying the set rule.
Preferably, the multi-process management apparatus of this embodiment further includes: a second receiving module 406, configured to receive a setting instruction through one of the multiple application processes before the first receiving module 402 enables the current process to receive the input instruction for setting the key; a second notifying module 408 for causing the process that received the setting instruction to notify the setting instruction to all processes of the plurality of applications except for itself; the setting instruction comprises information of a setting key, and the setting instruction is used for indicating a process receiving the input instruction of the setting key to display or hide a window for running the process.
Preferably, each process of the plurality of applications is provided with an inter-process communication manager, and the inter-process communication manager is used for storing and managing process information of the plurality of applications.
Preferably, the inter-process communication manager stores and manages process information of the processes of the plurality of applications through the mapping table.
Preferably, the process information includes information of a process identification and a host window handle.
Preferably, the multi-process management apparatus of this embodiment further includes: a registration module 410, configured to, before the second receiving module 406 receives the setting instruction through one of the multiple application processes, when a process is started among the multiple application processes, send a registration message to the started process by a newly started process; a first obtaining module 412, configured to enable a started process to obtain information of a newly started process through a registration message, and store the information in an inter-process communication manager of the started process; a reply module 414, configured to enable the started process to send a response message to the newly started process, where the response message carries process information in the interprocess communication manager of the started process; a second obtaining module 416, configured to enable the newly started process to obtain the process information in the inter-process communication manager of the started process, and store the process information in the inter-process communication manager of the newly started process.
Preferably, the started process is the process in which the top-level window is located.
Preferably, the started process comprises a plurality of processes; and the first process which receives the registration message in the plurality of started processes acquires the information of the newly started process through the registration message and sends a response message to the newly started process.
Preferably, the first notifying module 404 is configured to enable the current process to obtain process information of other processes stored in the inter-process communication manager of the current process; and according to the process information of other processes, informing the other processes of the instruction, and enabling the other processes to display or hide the windows operated by the other processes.
Preferably, the plurality of applications satisfying the set rule are a plurality of applications that run simultaneously using the same browser.
Preferably, the plurality of applications satisfying the set rule are a plurality of games launched using the game plug-in one browser.
The multi-process management apparatus of this embodiment is used to implement the corresponding multi-process management method in the foregoing multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which are not described herein again.
It should be noted that, the embodiments of the present application take a game as an example, but not limited to this, the multi-process management scheme of the present application can also be applied to other similar scenarios, such as opening multiple browsers supporting the tablet key simultaneously, and setting the tablet key in one browser can simultaneously act on the multiple opened browsers, and once the user presses the tablet key, the windows of the browsers will be hidden or displayed simultaneously. Or, if a plurality of programs of the same type, such as WORD programs, are opened at the same time, a hot key is arranged in one WORD program, and the opening or closing of a plurality of opened WORD documents can be realized. Therefore, through the multi-process management scheme, the functions of the setting keys such as the boss keys are effectively improved, and unified control and management of the setting keys in a multi-process mode are realized.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The multi-process management method and apparatus provided by the present application are introduced in detail above, and a specific example is applied in the present application to explain the principle and the implementation of the present application, and the description of the above embodiment is only used to help understand the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.