Summary of the invention
The technical problem to be solved in the present invention is, for existing customer, holds the defect that software interface implementation efficiency is lower, and a kind of system and method for client software operation is provided.
The technical solution adopted for the present invention to solve the technical problems is: constructs a kind of system of client software operation, comprises contact bed module and the functional layer module of human window application program, and the middle layer module of Active X module composition:
The Html code that the contact bed module operation of described window application embeds window application generates client software interface, and catch the trigger event on this client software interface by embedding the JavaScript code of window application, and the message of the trigger event of acquisition is transmitted to the functional layer module of window application by Active X assembly;
The functional layer module of described window application is carried out the Message Processing code of window application according to the message of trigger event, obtain feedback result, and the contact bed module that the message of feedback result is transmitted to described window application by Active X assembly shows by described client software interface.
In the system of moving according to client software of the present invention, the ActiveX assembly of described middle layer module has intermediate layer message processing unit, and has the message pool of using Memory Mapping File and its; Described intermediate layer message processing unit manages described Memory Mapping File and its, makes described contact bed module and functional layer module that the content of Memory Mapping File and its is read or be write.
In the system of moving according to client software of the present invention, described contact bed module further comprises:
Html unit, the Html code that embeds window application for moving generates client software interface, and the message that receives feedback result shows by described client software interface;
JavaScript unit, for catching the trigger event on described client software interface by embedding the JavaScript code of window application; And
Contact bed message processing unit, be connected with the intermediate layer message processing unit of described Html unit, JavaScript unit and middle layer module, message for trigger event that described JavaScript unit is obtained is transmitted to described intermediate layer message processing unit, and sends to described Html unit to show the message of the feedback result obtaining from described intermediate layer message processing unit.
In the system of moving according to client software of the present invention, described functional layer module further comprises:
Message performance element, for carry out the Message Processing code of window application according to the message of trigger event, obtains feedback result;
Functional layer message processing unit, for the message of the trigger event of the intermediate layer message processing unit acquisition from middle layer module is sent to described message performance element, and the message of the feedback result obtaining from described message performance element is sent to described intermediate layer message processing unit.
In the system of moving according to client software of the present invention, the ActiveX component internal of described middle layer module is set up asynchronous message transmission interface; The trigger event that described contact bed module and functional layer module send and the message of feedback result are for writing described Memory Mapping File and its by described asynchronous message transmission interface.
In the system of moving according to client software of the present invention, and the foundation of the ActiveX component internal of described middle layer module has message pool monitoring processing unit and self-defined message mapping macro interface; Described message pool monitoring processing unit, for monitoring message pond, judges whether to detect effective message; Described intermediate layer message processing unit shines upon macro interface when message pool monitoring processing unit monitors efficient message by described self-defined message, corresponding contact bed module or the functional layer module of being transmitted to.
The present invention also provides a kind of method of client software operation, comprises the following steps:
The html code that the contact bed module operation of S1, window application embeds window application generates client software interface, and catches the trigger event on this client software interface by embedding the JavaScript code of window application;
S2, described contact bed module are transmitted to the message of the trigger event of acquisition the functional layer module of window application by Active X assembly;
The functional layer module of S3, described window application is carried out the Message Processing code of window application according to the message of trigger event, obtain feedback result;
S4, described functional layer module are transmitted to the message of feedback result described window application contact bed module by Active X assembly shows by described client software interface.
In the method for moving according to client software of the present invention, described Active X module composition middle layer module; In described step S2 and S4, the Active X component internal of described middle layer module has intermediate layer message processing unit, and has the message pool of using Memory Mapping File and its; Described intermediate layer message processing unit manages described Memory Mapping File and its, makes described contact bed module or functional layer module that the content of Memory Mapping File and its is read or be write.
In the method for moving according to client software of the present invention, in described step S2 and S4, the ActiveX component internal of described middle layer module is set up asynchronous message transmission interface; The trigger event that described contact bed module and functional layer module send and the message of feedback result are for writing described Memory Mapping File and its by described asynchronous message transmission interface.
In the method for moving according to client software of the present invention, in described step S2 and S4, the ActiveX component internal of described middle layer module is set up message pool monitoring processing unit and self-defined message mapping macro interface; Described message pool monitoring processing unit, for monitoring message pond, judges whether to detect effective message; Described intermediate layer message processing unit shines upon macro interface when message pool monitoring processing unit monitors efficient message by described self-defined message, corresponding contact bed module or the functional layer module of being transmitted to.
Implement the system and method for client software operation of the present invention, there is following beneficial effect: the feature that the present invention utilizes the ActiveX assembly of Microsoft can be simultaneously to be used by client software and script, advantage in conjunction with Html design interface element, by ActiveX assembly, realize the forwarding of message, both response interface changed fast, can meet again highly difficult interface element design, also not affect its mutual dirigibility.And can in ActiveX, use Memory Mapping File and its to carry out communication as the functional layer of the window application of client end interface and the message pool of Html interface element.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.
Referring to Fig. 1, is the module diagram of the system of client software operation according to a preferred embodiment of the invention.As shown in Figure 1, the system of this client software operation comprises contact bed module 10 and the functional layer module 20 of human window application program, and by the middle layer module 30 of Active X module composition.
Below the constructive process of client software provided by the invention is specifically described, comprises the following steps:
Step 1: first use window application based on Windows operating system as program frame, design a window application of supporting Html.Take MFC as example, use guide to generate a dialog box program, select " use html dialog " option.
Step 2: use the mode of the Html+JavaScript interface of designing program, it comprises: use html language to carry out the layout of software interface element, use JavaScript to assist and realize mutual effect.The Html webpage having designed is embedded in the window application framework of design in step 1;
Step 3: create ActiveX assembly, as the communication middleware of window application framework and Html webpage.Take MFC as example, in guide, select MFC/MFC ActiveX Control.In design, complete after ActiveX assembly, by this ActiveX component register, to Windows operating system, this interface just can be called use ActiveX assembly by window application and Html+JavaScript like this.
After the above-mentioned client software interface based on web completes, the client software interface that this has designed shows with Html form web page, and is designed to the outward appearance at client software interface.The system that can move by client software as shown in Figure 1 after having designed is moved this client software.
The contact bed module 10 of window application embeds window application Html code for moving generates client software interface.This contact bed module 10 also catches the trigger event on this client software interface by embedding the JavaScript code of window application, and the message of the trigger event of acquisition is transmitted to the functional layer module 20 of window application by the Active X assembly of middle layer module 30.
The functional layer module 20 of window application is carried out the Message Processing code of window application according to the message of trigger event, obtain feedback result, and the contact bed module 20 that the Active X assembly by middle layer module 30 is transmitted to window application by the message of feedback result shows by client software interface.
In the system of client software operation provided by the invention, middle layer module 30 is to adopt Memory Mapping File and its 32 as message pool.When creating software, in ActiveX assembly, use Memory Mapping File and its as message pool, be used for reception and the transmission of administrative messag and the exchange of partial data.Be specially the component internal at ActiveX, distribute a memory headroom, use this space to generate Memory Mapping File and its.ActiveX assembly also has intermediate layer message processing unit 31, by 31 pairs of Memory Mapping File and its 32 of intermediate layer message processing unit, is managed, and makes the content of contact bed module 10 and 20 pairs of Memory Mapping File and its of functional layer module read or write.The form that content wherein can be appointed according to the Html webpage of functional layer module 20 and contact bed module 10, is called communications protocol, resolves.
The ActiveX component internal of middle layer module 30 is set up has asynchronous message transmission interface (PostMessage interface) to realize message write-in functions.The function of its realization writes to Memory Mapping File and its 32 (being message pool) message body of appointing form exactly.Be that contact bed module 10 and functional layer module 30 trigger events of transmission and the message of feedback result are for writing described Memory Mapping File and its by this PostMessage interface.
The ActiveX component internal of middle layer module 30 has also been set up message pool monitoring processing unit and self-defined message mapping macro interface (OnMessage interface).This message pool monitoring processing unit, for monitoring the Memory Mapping File and its as message pool, judges whether to detect effective message.Intermediate layer message processing unit 31 by this OnMessage interface when message pool monitoring processing unit monitors efficient message, corresponding contact bed module 10 or the functional layer module 20 of being transmitted to.
Refer to Fig. 1, contact bed module 10 further comprises: Html unit 13, JavaScript unit 12 and contact bed message processing unit 11.
Wherein, described Html unit 13 generates the client software interface of Html form web page for moving the Html code of above-mentioned embedding window application.And Html unit 13, after the message of feedback result that receives the functional layer module 20 that middle layer module 30 forwards, also shows by changing client software interface.
JavaScript unit 12 for example, for the trigger event on the client software interface of the JavaScript code seizure Html form web page by embedding window application, mouse event.For example, on the client software interface that, user has designed at Html webpage, click the button of a scanning registry error.JavaScript unit 12 captures this mouse event, generates the message of trigger event, as the message of MSG_SCAN_REGISTER_ERR (self-defined message can be character string) by event response function.
Contact bed message processing unit 11, be connected with Html unit 13, JavaScript unit 12 and intermediate layer message processing unit 31, the message of the trigger event that JavaScript unit 12 is obtained is transmitted to intermediate layer message processing unit 31, then in activex component internal, by PostMessage interface, the message of this trigger event is write to message pool by intermediate layer message processing unit 31.Contact bed message processing unit 13 also sends to Html unit 13 to show the message of the feedback result obtaining by OnMessage interface from middle layer message processing unit 31.
Functional layer module 20 further comprises: functional layer message processing unit 21 and message performance element 22.Wherein, functional layer message processing unit 21 is connected with message performance element 22 with intermediate layer message processing unit 31, for the message of the trigger event obtaining by OnMessage interface from middle layer message processing unit 31 is sent to message performance element 22.By this message performance element 22, received again the message of this trigger event, for example determining is the instruction of a scanning registry error, carries out the Message Processing code of window application, carries out registration table scanning, and generate the message of feedback result, as SCAN_FINISH message.Scanning completes, and the functional layer message processing unit 21 of functional layer module 20 writes this SCAN_FINISH message by the PostMessage interface of intermediate layer message processing unit 31 in message pool (Memory Mapping File and its).
Below the detailed process of the method for client software operation of the present invention is described.This client software also needs to create by the step of the constructive process of aforesaid client software.The client software interface that this has designed shows with Html form web page, and is designed to the outward appearance at client software interface.The method that can move by following client software after having designed is moved this client software.
First, in step S1, the html code that the contact bed module operation of window application embeds window application generates client software interface, and catches the trigger event on this client software interface by embedding the JavaScript code of window application.
Subsequently, in step S2, contact bed module is transmitted to the message of the trigger event of acquisition the functional layer module of window application by Active X assembly.
Subsequently, in step S3, the functional layer module of window application is carried out the Message Processing code of window application according to the message of trigger event, obtain feedback result.
Finally, in step S4, functional layer module is transmitted to the message of feedback result described window application contact bed module by Active X assembly shows by described client software interface.
Referring to Fig. 2, is the particular flow sheet of the method for client software according to the present invention operation.As shown in Figure 2, the concrete steps of the method for this client software operation comprise:
First, in step S201, contact bed module is obtained for example mouse event of trigger event by the client software interface generating with Html.For example, on the client software interface that, user has designed at Html webpage, click the button of a scanning registry error.JavaScript unit captures this mouse event, generates the message of trigger event, as the message of MSG_SCAN_REGISTER_ERR (self-defined message can be character string) by event response function.The function of the corresponding above-mentioned steps S1 of this step.
Subsequently, in step S202, in ActiveX component internal, by PostMessage interface, the message of this trigger event is write to message pool.In the method, middle layer module is the middle communication parts by ActiveX module composition, and adopts Memory Mapping File and its as message pool.When creating software, in ActiveX assembly, use Memory Mapping File and its as message pool, be used for reception and the transmission of administrative messag and the exchange of partial data.Be specially the component internal at ActiveX, distribute a memory headroom, use this space to generate Memory Mapping File and its.ActiveX assembly also has intermediate layer message processing unit, by intermediate layer message processing unit, Memory Mapping File and its is managed, and makes contact bed module and functional layer module that the content of Memory Mapping File and its is read or be write.The form that content wherein can be appointed according to the Html webpage of functional layer module and contact bed module, is called communications protocol, resolves.
The ActiveX component internal of middle layer module is set up has asynchronous message transmission interface (PostMessage interface) to realize message write-in functions.The function of its realization writes to Memory Mapping File and its (being message pool) message body of appointing form exactly.Be that contact bed module and the trigger event of functional layer module transmission and the message of feedback result are for writing described Memory Mapping File and its by this PostMessage interface.
Subsequently, in step S203, the intermediate layer message processing unit of middle layer module learns that by OnMessage interface detecting effective message comes message pool, takes out this message and sends to functional layer module.Step S202 and step S203 have completed the function of above-mentioned steps S2.The ActiveX component internal of middle layer module has also been set up message pool monitoring processing unit and self-defined message mapping macro interface (OnMessage interface).This message pool monitoring processing unit, for monitoring the Memory Mapping File and its as message pool, judges whether to detect effective message.Intermediate layer message processing unit by this OnMessage interface when message pool monitoring processing unit monitors efficient message, the corresponding functional layer module that is transmitted to.
Subsequently, in step S204, functional layer module receives the message of this trigger event, carries out the Message Processing code of window application, generates the message of feedback result.For example, functional layer module receives the message of this trigger event, and for example determining is the instruction of a scanning registry error, carry out the Message Processing code of window application, carry out registration table scanning, and generate the message of feedback result, as SCAN_FINISH message.The function of the corresponding above-mentioned steps S3 of this step.
Subsequently, in step S205, in activex component internal, by PostMessage interface, the message of this feedback result is write to message pool.For example, write above-mentioned SCAN_FINISH message.
Subsequently, in step S206, intermediate layer message processing unit learns that by OnMessage interface detecting effective message comes message pool, and the message of taking out this feedback result sends to contact bed module.
Subsequently, in step S207, contact bed module shows the message of the feedback result of reception by described client software interface.Step S205, step S206 and step S207 have completed the function of above-mentioned steps S4.
The present invention is described according to specific embodiment, but it will be understood by those skilled in the art that when not departing from the scope of the invention, can carry out various variations and be equal to replacement.In addition,, for adapting to specific occasion or the material of the technology of the present invention, can carry out many modifications and not depart from its protection domain the present invention.Therefore, the present invention is not limited to specific embodiment disclosed herein, and comprises all embodiment that drop into claim protection domain.