The present disclosure relates to computer technology, and more particularly, to a method and a system for sharing a hotkey between application instances.
When using a computer, a user often uses a variety of applications, such as an instant messaging (IM) software tool. Usually, in order to facilitate the user to use an application, the application may employ a hotkey function provided by a system, or the user may register a hotkey for the application. A hotkey may be a shortcut key, which may be a combination of several special keys on a keyboard and may implement a specific task. Work efficiency may be significantly improved through using the hotkey. For example, a hotkey like Del+Ctrl+Alt may open a task manager under a windows operating system.
Examples of the present disclosure provide a method for sharing a hotkey between application instances, so that a hotkey may be inherited by another application instance when an application instance that currently registers the hotkey exits and the hotkey may be shared.
Examples of the present disclosure provide a system for sharing a hotkey between application instances, so that a hotkey may be inherited by another application instance when an application instance that currently registers the hotkey exits and the hotkey may be shared.
The technical solution provided by the examples of the present disclosure is shown as follows.
A method for sharing a hotkey between application instances includes:
receiving a hotkey release message from an application instance that registers a first hotkey, wherein the hotkey release message is to release the first hotkey and comprises identification information about the first hotkey; and
according to the identification information about the first hotkey, initiating a register request for registering the first hotkey.
A system for sharing a hotkey between application instances includes a first application instance, wherein the first application instance does not register a first hotkey and includes:
a first releasing module, to receive a hotkey release message from an application instance that registers the first hotkey, wherein the hotkey release message is to release the first hotkey and comprises identification information about the first hotkey; and
a registering module, to initiate, according to the identification information about the first hotkey, a register request for registering the first hotkey.
As may be seen from the above technical solution, the method provided by the examples of the present disclosure may include receiving a hotkey release message from an application instance that registers a first hotkey, wherein the hotkey release message is to release the first hotkey and includes identification information about the first hotkey; and according to the identification information about the first hotkey, initiating a register request for registering the first hotkey. When examples of the present disclosure are employed, between application instances, when an application instance that currently registers a hotkey exits, the application instance that currently the hotkey may notify a next application instance to register the hotkey, so that the transitivity of the hotkey may be ensured, the hotkey may be shared, and the accuracy of hotkey response may be improved.
Hereinafter, the present disclosure will be described in further detail with reference to the accompanying drawings and exemplary examples.
Usually, one application may run a plurality of instances. Taking an IM application as an example, a plurality of IM applications, i.e., a plurality of instances may be run simultaneously. A plurality of instances of applications with a same type that are run simultaneously may be called the plurality of instances of the applications with this type. A plurality of instances of applications with different types that are run simultaneously may be called the plurality of instances of the applications with the different types. It may be expected that a same hotkey may be used either among the plurality of the instances of the applications with the same type or among the plurality of the instances of the applications with the different types.
However, either a hotkey used among the plurality of the applications with the various different types running simultaneously or a hotkey used among the plurality of the application instances with the same type running simultaneously may usually be exclusive. If an application registers a hotkey, another application may not register the hotkey again. Likewise, if an application instance registers a hotkey, another application instance with a same type may not register the hotkey again. As such, the application that fails to register the hotkey may not provide a convenient utilization way for users. Moreover, when an application instance that registers a hotkey exits, the hotkey may be taken back by the system, but other application instances may not timely receive a notice that the hotkey has been released, and thus may not timely re-register the hotkey.
It is assumed that three IM application instances with a same type are running, in which the three IM application instances may respectively be referred to as AIM, BIM, and CIM. When started up, each of the IM application instances may attempt to register a hotkey formed by a same key combination. However, an IM application instance that may firstly register the hotkey (e.g., AIM) may successfully register the hotkey. When the user activates the hotkey, AIM may receive a hotkey message (e.g., a hotkey for extracting a message (a default key combination may be Ctrl+Atl+Z)). AIM successfully registers the hotkey, BIM and CIM may fail to register the hotkey.
In circumstance 1: AIM, BIM, and CIM are running simultaneously, and AIM successfully registers the hotkey for extracting a message. At this time, if a message is sent to BIM, the user may press Ctrl+Atl+Z to trigger the hotkey for extracting the message, and AIM may receive a hotkey message. However, since there is no new message for AIM, AIM may not process the hotkey message. In this case, the user may not extract the message of BIM. This circumstance may not meet expectations of the user, and may cause obsession to the user and affect user experience.
In circumstance 2: AIM, BIM, and CIM are running simultaneously, AIM successfully registers the hotkey for extracting a message, but AIM exits. At this time, if a message is sent to BIM, the hotkey for extracting the message may not be triggered when the user presses Ctrl+Atl+Z. As such, the user may not extract the message of BIM. This circumstance may not meet the expectations of the user, and may cause the obsession to the user and affect the user experience.
In examples of the present disclosure, the application instances may be a plurality of application instances with a same application type, or may be a plurality of application instances with different application types.
In examples of the present disclosure, an application instance may be run on a personal computer, or may exist in the form of a web page, or may be run on a wireless device like a mobile phone.
Hereinafter, examples of the present disclosure may be described in further detail taking the plurality of application instances with the same application type as an exemplary example. However, those skilled in the art may recognize that the description may be illustrative and may not be intended to limit the protection scope of the examples of the present disclosure.
Each of a plurality of the application instances with the same application type may initiate a register request for registering a hotkey when the application instance is started up. Since these application instances may run the applications with the same type, the hotkeys registered by these application instances may be identical.
For example, with regard to an IM application, a hotkey like Ctrl+Atl+Z may be a hotkey for extracting a message. When a plurality of IM application instances are started up, each of a plurality of the IM application instances may attempt to register the hotkey Ctrl+Atl+Z as the hotkey for extracting a message. Then, it may be determined whether a hotkey to be registered by an application instance which may firstly initiate the register request for registering the hotkey has already been occupied by an application with another type (i.e., the application with the other type may not be the IM application). If the hotkey is not occupied by the application with the other type, the application instance which may firstly initiate the register request for registering the hotkey may successfully register the hotkey. If the hotkey is occupied by the application with the other type and the application with the other type is running, it may be determined that the hotkey is occupied, and it may be prompted to the IM application instance which may firstly initiate the register request for registering the hotkey that hotkey registration is failed. In this case, the IM application instance which may firstly initiate the register request for registering the hotkey may further be prompted to change the hotkey and to re-register the changed hotkey.
When an application instance successfully registers a hotkey, if the hotkey is triggered, that is, when a hotkey message appears, the application instance that registers the hotkey may receive the hotkey message. The application instance that registers the hotkey may distribute the hotkey message to an application instance that does not register the hotkey, and may determine whether there is an application instance that does not register the hotkey and is to process the hotkey message. In response to a determination that there is the application instance that does not register the hotkey and is to process the hotkey message, the application instance that does not register the hotkey may process the hotkey message, and the application instance that registers the hotkey may receive feedback information about processing the hotkey message returned from the application instance that does not register the hotkey and may end the process. Otherwise, in response to a determination that there is not the application instance that does not register the hotkey and is to process the hotkey message, the application instance that registers the hotkey may process the hotkey message, and may end the process.
In block 101, a hotkey release message (which may also be referred to as a hotkey register message) may be received from an application instance that registers a hotkey. The hotkey release message may release the hotkey, and may include identification information about the released hotkey.
In this case, the identification information about the released hotkey may mark out a specific hotkey combination.
In block 102, according to the identification information about the released hotkey, a register request for registering the released hotkey may be initiated.
In an example of the present disclosure, the method as shown in
after the application instance that registers the hotkey requests to release the hotkey resources, the application instance that registers the hotkey may send the hotkey release message to other application instances that do not register the hotkey one by one. Further, when the application instance that registers the hotkey exits and after the application instance that registers the hotkey requests to release the hotkey resources, the application instance that registers the hotkey may send the hotkey release message to other application instances that do not register the hotkey one by one.
In an example of the present disclosure, after the application instance that registers the hotkey requests to release the hotkey resources, the application instance that registers the hotkey may send, according to a predetermined order, the hotkey release message to other application instances that do not register the hotkey. In this case, the predetermined order may include but not be limited to:
an order of start-up time points of a plurality of the application instances; and/or
a chronological order of a plurality of application instances for receiving the hotkey release message.
In an example of the present disclosure, after the operation of initiating the register request for registering the hotkey based on the identification information about the released hotkey, the method as shown in
when it is determined that the register request for registering the hotkey is unsuccessful, a query request for querying whether the released hotkey is successfully registered may be sent to other application instances one by one;
when any one result returned in response to the query request indicates that the released hotkey has been successfully registered, the sending of the query request may be stopped.
In an example of the present disclosure, the method as shown in
after an application instance successfully registers the hotkey according to the hotkey register message, if there is a hotkey message of the hotkey, the application instance that registers the hotkey may receive the hotkey message, distribute the hotkey message to an application instance that does not register the hotkey, and may determine whether there is an application instance that does not register the hotkey and is to process the hotkey message. In response to a determination that there is the application instance that does not register the hotkey and is to process the hotkey message, the application instance that does not register the hotkey may process the hotkey message, and the application instance that registers the hotkey may receive feedback information about processing the hotkey message returned from the application instance that does not register the hotkey. Otherwise, in response to a determination that there is not the application instance that does not register the hotkey and is to process the hotkey message, the application instance that registers the hotkey may process the hotkey message.
A hotkey for extracting an IM message may be taken as an example. It may be assumed that two IM application instances with a same application type are running, in which the two IM application instances may respectively be referred to as AIM and BIM. In this case, Ctrl+Atl+Z may be registered by AIM as the hotkey for extracting an IM message and BIM does not register the hotkey. When a user presses Ctrl+Atl+Z to trigger the hotkey for extracting an IM message, AIM may receive a hotkey message, and may distribute the hotkey message to BIM. After receiving the hotkey message, BIM may determine whether to process the hotkey message according to a situation of BIM. Specifically, BIM may check whether there is an IM message of BIM. If there is the IM message of BIM, BIM may extract the IM message and return to AIM a message indicating that the hotkey message is processed. If there is not the IM message of BIM, BIM may not process the hotkey message and return to AIM a message indicating that the hotkey message is not processed. At this time, AIM may determine whether to process the hotkey message according to a situation of AIM. Specifically, AIM may check whether there is an IM message of AIM. If there is the IM message of AIM, AIM may extract the IM message. If there is not the IM message of AIM, AIM may not process the hotkey message.
In an example of the present disclosure, an operation of configuring a hotkey re-registration order may be included. In this case, the method as shown in
when the application instance that registers the hotkey exits, the hotkey register message may be sent, according to the hotkey re-registration order, to an application instance in a next order of the application instance that registers the hotkey. The application instance in the next order may register the hotkey according to the hotkey register message.
In this case, the hotkey re-registration order may include but not be limited to:
an order of start-up time points of a plurality of the application instances; and/or
a chronological order of a plurality of application instances for receiving the hotkey register message.
As may be seen that when examples of the present disclosure are employed, between application instances, when an application instance that currently registers a hotkey exits, the application instance that registers the hotkey may notify a next application instance to register the hotkey. In other words, the hotkey may be inherited by a subsequent application instance. By this manner, a deficiency in the prior art that when an application instance that registers a hotkey exits, the hotkey is taken back by the system, another application instance may not re-register and use the hotkey may be overcome, so that the transitivity of the hotkey may be ensured, the hotkey may be shared, and the accuracy of hotkey response may be improved.
Although some specific application types are enumerated above to describe the examples of the present disclosure, those skilled in the art may recognize that the enumeration may be for illustrative purposes and may not be intended to limit the protection scope of the present disclosure.
In fact, these application instances may belong to different application types. In this case, examples of the present disclosure may be applied to a plurality of application instances that may belong to applications with different application types and may expect to register a same hotkey, and may also be applied to hotkey sharing after a plurality of the application instances with the different application types exit. Hereinafter, examples of the present disclosure may be described in further detail with reference to the application instances with the same type.
In an example of the present disclosure, when a plurality of application instances with a same type are running, each of a plurality of the application instances with the same type may register a hotkey to the system when each of the application instances is started up. For each of a plurality of the application instances, if the hotkey registration is successful, the hotkey registration process may be ended. If the hotkey is registered by an application with another type, a hotkey registration failure message may be returned to a user, and the user may be prompted to change the hotkey and to re-register the changed hotkey. If the hotkey is not registered by the application with the other type but the registration is failed, the application instance may query, through crossing processes, a plurality of the application instances with the same type one by one whether the hotkey is successfully registered. If one query result returned is success, the query may be interrupted, and the hotkey registration process may be ended. If all query results returned are failure (i.e., all of other application instances with the same type do not register the hotkey), a prompt may be popped up to prompt the user that the hotkey registration is failed and the hotkey cannot be used.
In process 201, an application instance A may initiate a register request for registering a hotkey S (i.e., a combination of some keys) to an operating system, and may successful registers the hotkey S.
In process 202, an application instance B may initiate the register request for registering the hotkey S to the operating system. The operating system may receive the register request, determine that the application instance A has registered the hotkey S, and may return a hotkey registration failure message to the application instance B.
In process 203, the application instance B may send a query message to the application instance A to query whether the application instance A has registered the hotkey S.
In process 204, the application instance A may send a reply message to the application instance B to inform application instance B that the application instance A has registered the hotkey S. The application instance B may receive the reply message, and analyze the reply message to determine that the hotkey S has been registered by the application instance A.
In process 205, an application instance C may initiate the register request for registering the hotkey S to the operating system. The operating system may receive the register request, determine that the application instance A has registered the hotkey S, and may return the hotkey registration failure message to the application instance C.
In process 206, the application instance C may send a query message to the application instance B to query whether the application instance B has registered the hotkey S.
In process 207, the application instance B may send a reply message to the application instance C to inform application instance C that the application instance B does not register the hotkey S.
In process 208, the application instance C may send a query message to the application instance A to query whether the application instance A has registered the hotkey S.
In process 209, the application instance A may send a reply message to the application instance C to inform application instance C that the application instance A has registered the hotkey S. The application instance C may determine, through analyzing the reply message, that the hotkey S is registered by the application instance A.
So far, operations for registering a hotkey by a plurality of application instances with a same type may be achieved. In this case, when a user triggers the hotkey, the system may pop up a hotkey message, and the application instance that registers the hotkey may receive the hotkey message. The application instance that registers the hotkey may distribute, through crossing processes, the hotkey message to each of the application instances with the same type one by one. Each of other application instances may receive the cross-process hotkey message, and may determine, according to a situation of the application instance itself, whether to process the hotkey message. If an application instance may determine to process the hotkey message, the application instance may process the hotkey message and may return a message indicating that the hotkey message is processed to the application instance that registers the hotkey. If an application instance may determine not to process the hotkey message, the application instance may return a message indicating that the hotkey message is not processed to the application instance that registers the hotkey. When one returned message indicating that the hotkey message is processed is received, the application instance that registers the hotkey may interrupt remaining distribution. If all messages returned are the message indicating that the hotkey message is not processed, the application instance that registers the hotkey may determine whether to process the hotkey message according to a situation of the application instance that registers the hotkey.
According to this logic, after receiving a hotkey message of the system, the application instance that registers the hotkey may firstly send the hotkey message to an application instance that does not register the hotkey, while the application instance that registers the hotkey may be the last application instance that may process the hotkey message. By this manner, all of the application instances (both the application instance that registers the hotkey and the application instance that does not register the hotkey) may have an opportunity to process the hotkey message.
Based on the above detailed analysis and the process as shown in
In process 301, when a user triggers the hotkey S, the application instance A may receive a hotkey message, and may send the hotkey message to the application instance B.
In process 302, the application instance B may receive the hotkey message, and may determine whether to process the hotkey message. In this case, the application instance B may determine not to process the hotkey message, and may return a message indicating that the hotkey message is not processed to the application instance A.
In process 303, the application instance A may receive the message indicating that the hotkey message is not processed sent from the application instance B, and may send the hotkey message to the application instance C.
In process 304, the application instance C may receive the hotkey message, and may determine whether to process the hotkey message. In this case, the application instance C may determine to process the hotkey message. The application instance C may process the hotkey message, and may return a message indicating that the hotkey message is processed to the application instance A.
Based on the above detailed analysis and the process as shown in
In process 401, when a user triggers the hotkey S, the application instance A may receive a hotkey message and may send the hotkey message to the application instance B.
In process 402, the application instance B may receive the hotkey message, and may determine whether to process the hotkey message. In this case, the application instance B may determine not to process the hotkey message, and may return a message indicating that the hotkey message is not processed to the application instance A.
In process 403, the application instance A may receive the message indicating that the hotkey message is not processed sent from the application instance B, and may send the hotkey message to the application instance C.
In process 404, the application instance C may receive the hotkey message, and may determine whether to process the hotkey message. In this case, the application instance C may determine not to process the hotkey message, and may return the message indicating that the hotkey message is not processed to the application instance A.
In process 405, the application instance A may receive the message indicating that the hotkey message is not processed sent from the application instance C, determine that all of the application instances that do not register the hotkey are not to process the hotkey message, and may process the hotkey message based on a situation of the application instance A.
Based on the above detailed analysis, examples of the present disclosure may also provide a system for sharing a hotkey between application instances.
The first releasing module 501 may receive a hotkey release message (which may also be referred to as a hotkey register message) sent from an application instance that registers the hotkey, in which the hotkey release message may release the hotkey, and may include identification information about the released hotkey.
The registering module 502 may initiate a register request for registering the hotkey based on the identification information about the hotkey received by the first releasing module 501.
Based on the system structure as shown in
The second releasing module 503 may send, after requesting to release hotkey resources, the hotkey release message to other application instances that do not register the hotkey one by one.
In an example of the present disclosure, when the application instance that registers the hotkey exits and after the application instance that registers the hotkey requests to release the hotkey resources, the second releasing module 503 may send the hotkey release message to other application instances that do not register the hotkey one by one.
In the system for sharing the hotkey between the application instances as shown in
After the registering module 502 initiates the register request for registering the released hotkey and in response to a determination that the register request for registering the released hotkey is unsuccessful, the determining module 504 may send a query request for querying whether the released hotkey is successfully registered to other application instances one by one. When any one result returned in response to the query request indicates that the hotkey has been successfully registered, the determining module 504 may stop the sending of the query request.
When the application instance that does not register the hotkey has successfully registered a hotkey and there is a hotkey message of the hotkey, the processing module 505 may receive the hotkey message; distribute the hotkey message to application instances that do not register the hotkey; determine whether there is an application instance that does not register the hotkey and is to process the hotkey message; when there is the application instance that does not register the hotkey and is to process the hotkey message, receive feedback information about processing the hotkey message returned from the application instance that does not register the hotkey; when there is not the application instance that does not register the hotkey and is to process the hotkey message, process the hotkey message.
In an example of the present disclosure, the second releasing module 503 may send, after requesting to release the hotkey resources, the hotkey release message to other application instances according to a predetermined order. In this case, the predetermined order may include but not be limited to:
an order of start-up time points of a plurality of the application instances; and/or
a chronological order of a plurality of application instances for receiving the hotkey release message.
As may be seen that when the technical solution of cross-process hotkey sharing between application instances with a same type or between applications with various types provided by examples of the present disclosure are employed, hotkey conflicts between applications may be solved, and when an application instance that registers a hotkey exits, the hotkey may be timely and effectively inherited, thus the hotkey resources may be shared, and the user experience may further be optimized.
Hereinafter, examples of the present disclosure may be described in further detail taking an IM application as an example. For the IM application, the solution of cross-process hotkey sharing provided by the examples of the present disclosure may be achieved by means of component object model (COM) remote call. Specifically, an IM component may be created firstly, and a set of interfaces (which may include an IMAPI interface and an IMMainCreator interface) may be implemented based on a COM specification. The IM component and the set of interfaces may be registered in the system. Among them, the IMAPI interface may provide a method for querying whether a hotkey is registered and a method for responding a hotkey message. The IMMainCreator interface may provide a method for traversing all of IM application instances, and may return all of the IMAPI interfaces to a caller.
When an IM application instance fails to register a hotkey, the IM application instance may obtain, from the system, the IM component and the IMMainCreator interface of the IM component. The IMMainCreator interface may obtain, through the method for traversing all of the IM application instances, IMAPI interfaces of all of IM application instances that are currently running, and may call the IMAPI interfaces one by one to query whether the hotkey is registered. In this case, if an IMAPI interface returns a message indicating that the hotkey is registered, remaining calling may be interrupted, and the process may be ended. If all of the IMAPI interfaces may return a message indicating that the hotkey is not registered, a prompt may be popped up to inform the user (this operation may be specifically defined by a specific product), and the process may be ended.
When an IM application instance receives a hotkey message of the system, the IM application instance may obtain, from the system, the IM component and the IMMainCreator interface of the IM component. The IMMainCreator interface may obtain, through the method for traversing all of the IM application instances, IMAPI interfaces of all of IM application instances that are currently running, and may call the IMAPI interfaces one by one to response the hotkey message. In this case, if an IMAPI interface returns a message indicating that the hotkey message is processed, remaining calling may be interrupted, and the process may be ended. If all of the IMAPI interfaces may return a message indicating that the hotkey message is not processed, the IM application instance that receives the system hotkey message may process the hotkey message, and may end the process.
The above example may describe how to achieve the cross-process hotkey sharing by means of the COM remote call. Examples of the present disclosure may not be limited to this exemplary example. The cross-process hotkey sharing may also be achieved by means of various ways such as a shared memory, or an anonymous pipe, etc.
Similarly, although the above examples of the present disclosure may be descried taking the IM application as an example, examples of the present disclosure may not be limited to the IM application. The examples of the present disclosure may also be applied to any other appropriate scenarios.
When examples of the present disclosure are employed, the aforementioned three IM application instances AIM, BIM, and CIM may still be taken as an example.
In case 1 which employs the examples of the present disclosure, AIM, BIM, and CIM may run simultaneously, and AIM may successfully register a hotkey for extracting a message. At this time, a message is sent to BIM. A user may press Ctrl+Atl+Z to trigger the hotkey for extracting the message, and AIM may receive a hotkey message. After receiving the hotkey message, AIM may forward the hotkey message to BIM (alternatively, AIM may forward the hotkey message to CIM; CIM may determine that CIM does not need to process the hotkey message, and may return a message indicating that the hotkey message is not processed to AIM; AIM may receive the message indicating that the hotkey message is not processed, and may forward the hotkey message to BIM). BIM may receive the hotkey message, detect that there is a new message, pop up the new message, and may return a message indicating that the hotkey message is processed to AIM. This solution meets the user's expectations, and enhances the user experience.
In case 2 which employs the examples of the present disclosure, AIM, BIM, and CIM may run simultaneously, AIM may successfully register a hotkey for extracting a message and then exit. When AIM exits, AIM may send a hotkey register message (which may also be referred to as a hotkey release message) to BIM and CIM, respectively, so as to notify BIM and CIM to re-register the hotkey. BIM and CIM may receive the hotkey register message, and may register the hotkey immediately. However, according to a predetermined order, an IM application instance that firstly registers the hotkey may successfully register the hotkey. In this case, assuming that BIM successfully registers the hotkey, as such, BIM may take the place of AIM. When the user presses Ctrl+Atl+Z to trigger the hotkey for extracting a message, BIM may receive a hotkey message, and may distribute the hotkey message. This solution meets the user's expectations, and enhances the user experience.
Although the above examples of the present disclosure may be descried taking the IM application as an example, those skilled in the art may recognize that the enumeration may be for illustrative purposes and may not be intended to limit the protection scope of the present disclosure.
When examples of the present disclosure are employed, between application instances, when an application instance that currently registers a hotkey exits, the application instance that currently registers the hotkey may notify a next application instance to register the hotkey, so that the transitivity of the hotkey may be ensured, the hotkey may be shared, and the accuracy of hotkey response may be improved.
The above are several examples of the present disclosure, and are not used for limiting the protection scope of the present disclosure. Any modifications, equivalents, improvements, etc., made under the spirit and principle of the present disclosure should be included in the protection scope of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
201210017554.3 | Jan 2012 | CN | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2013/070682 | 1/18/2013 | WO | 00 |