[go: up one dir, main page]

CN119806517A - Development framework and web page control integration method and device - Google Patents

Development framework and web page control integration method and device Download PDF

Info

Publication number
CN119806517A
CN119806517A CN202411701572.2A CN202411701572A CN119806517A CN 119806517 A CN119806517 A CN 119806517A CN 202411701572 A CN202411701572 A CN 202411701572A CN 119806517 A CN119806517 A CN 119806517A
Authority
CN
China
Prior art keywords
target
resource
development framework
webpage control
control
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202411701572.2A
Other languages
Chinese (zh)
Inventor
杨玉成
魏安权
汤永浩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Caxa Technology Co Ltd
Original Assignee
Caxa Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Caxa Technology Co Ltd filed Critical Caxa Technology Co Ltd
Priority to CN202411701572.2A priority Critical patent/CN119806517A/en
Publication of CN119806517A publication Critical patent/CN119806517A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The application discloses an integration method and device of a development framework and a webpage control, and relates to the technical field of software development. The method comprises the steps of embedding a target webpage control in a target development framework, wherein the target development framework is used for accessing a local file system, a registry and a local interface, the target webpage control is used for displaying and interacting webpage content in a native application program, constructing a target layer and a target structure, wherein the target layer is used for processing data type conversion, event transmission and data exchange between the target development framework and the target webpage control, the target structure is used for determining a resource loading mode, and integrating the target development framework and the target webpage control according to the target layer and the target structure to obtain the target application program. The application solves the technical problems of limitation of MFC application interfaces and insufficient utilization of local resources of Web applications in the prior art.

Description

Integration method and device for development framework and webpage control
Technical Field
The application relates to the technical field of software development, in particular to an integration method and device of a development framework and a webpage control.
Background
With the rapid development of information technology, users have put higher demands on the interactive experience of software applications. In the field of desktop application development, traditional MFC (Microsoft Foundation Classes, microsoft base class library) applications are favored by developers for their stable performance and efficient use of local resources. However, MFC applications have certain limitations in building complex and modern user interfaces, particularly in handling dynamic content, achieving smooth animation effects, supporting multi-platform compatibility, and the like, with relatively little support provided by MFCs.
At the same time, web-based technologies, such as HTML (HyperText Markup Language ), CSS (CASCADING STYLE SHEETS, cascading style sheets), and JavaScript (a programming language), provide a powerful tool and framework for building rich and interactive user interfaces. These techniques allow developers to create interfaces that are visually prominent, user experienced well, and can easily implement cross-platform operations. Pure Web applications typically run in browser environments and have difficulty directly accessing and utilizing local system resources such as hardware acceleration, file systems, local databases, and the like. This limits the application of Web applications in scenarios where performance requirements are high or where deep system integration is required.
Therefore, in the development of modern software, how to balance the advantages and disadvantages of the traditional MFC application program and the pure Web application, and fully utilize the respective advantages, becomes a problem to be solved urgently.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The application provides a method and a device for integrating a development framework and a webpage control, which at least solve the technical problems of limitation of an MFC application interface and insufficient utilization of local resources of a Web application in the prior art.
According to one aspect of the application, an integration method of a development framework and a webpage control is provided, which comprises the steps of embedding the target webpage control in a target development framework, wherein the target development framework is used for accessing a local file system, a registry and a local interface, the target webpage control is used for displaying and interacting webpage content in a native application program, constructing a target layer and a target structure, wherein the target layer is used for processing data type conversion, event transmission and data exchange between the target development framework and the target webpage control, the target structure is used for determining a resource loading mode, and integrating the target development framework and the target webpage control according to the target layer and the target structure to obtain a target application program.
Optionally, constructing the target layer and the target structure comprises constructing the target layer according to a first communication mode, a second communication mode and a third communication mode, wherein the first communication mode is used for realizing unidirectional communication between the target development frame and the target webpage control, the second communication mode is used for realizing bidirectional communication between the target development frame and the target webpage control, the third communication mode is used for processing data transmission between the target development frame and the target webpage control, the target structure is determined according to a resource loading strategy and a page display mode, the resource loading strategy is used for determining sources of data resources, and the page display mode is used for determining a switching mode between pages.
Optionally, before the target layer is built according to the first communication mode, the second communication mode and the third communication mode, the method for integrating the development framework and the webpage control further comprises the steps of obtaining a first calling method and a second calling method, wherein the first calling method is used for transmitting information from the target development framework to the target webpage control, the second calling method is used for transmitting information from the target webpage control to the target development framework, determining the first communication mode according to the first calling method and the second calling method, obtaining a third calling method, wherein the third calling method is used for opening the calling authority of a function object in the target development framework to the target webpage control, determining the second communication mode according to the third calling method, obtaining a fourth calling method, wherein the fourth calling method is used for building a shared memory channel between the target development framework and the target webpage control, and determining the third communication mode according to the fourth calling method.
Optionally, the method for integrating the development framework and the webpage control further comprises the steps of creating an objective function object in the process of determining the second communication mode according to the third calling method, wherein the objective function object comprises a plurality of function processing methods and function attributes, and registering the objective function object in the objective webpage control according to the third calling method.
Optionally, determining the third communication mode according to the fourth calling method comprises creating a shared memory cache area in a target development framework, acquiring a target interface, wherein the target interface is used as a target webpage control to access an access channel of the shared memory cache area, and determining the third communication mode according to the shared memory cache area, the fourth calling method and the target interface.
The resource loading strategy is obtained by acquiring a resource request, judging whether a target resource corresponding to the resource request belongs to a resource in a local cache, checking whether the version of the target resource is the latest version or not under the condition that the target resource is determined to belong to the resource in the local cache, outputting the target resource under the condition that the version of the target resource is the latest version, acquiring the latest version of the resource from a network under the condition that the version of the target resource is not the latest version, updating the latest version of the resource into the local cache, outputting the latest version of the resource from the local cache, and acquiring the target resource from the network under the condition that the target resource is not the resource in the local cache, updating the target resource into the local cache and outputting the target resource.
Optionally, the method for integrating the development framework and the webpage control further comprises the steps of obtaining a target method, wherein the target method is used for preloading data resources in the target webpage control, preloading the data resources with the use frequency exceeding a first preset threshold value according to the target method in the process of starting the target application program, configuring a delayed loading strategy and an operation caching strategy, wherein the delayed loading strategy is used for delaying loading of first-class data resources and second-class data resources, the first-class data resources are data resources which do not affect normal starting of the target application program, the second-class data resources are data resources which are irrelevant to processing of user requests, and the operation caching strategy is used for caching historical data resources which are already loaded by the target webpage control.
According to the application, the integrated device of the development framework and the webpage control comprises an embedding unit and an integrating unit, wherein the embedding unit is used for embedding the target webpage control into the target development framework, the target development framework is used for accessing a local file system, a registry and a local interface, the target webpage control is used for displaying and interacting webpage content in a native application program, the constructing unit is used for constructing a target layer and a target structure, the target layer is used for processing data type conversion, event transmission and data exchange between the target development framework and the target webpage control, the target structure is used for determining a resource loading mode, and the integrating unit is used for integrating the target development framework and the target webpage control according to the target layer and the target structure to obtain the target application program.
According to another aspect of the present application, there is further provided a computer readable storage medium, where a computer program is stored in the computer readable storage medium, where when the computer program runs, a device where the computer readable storage medium is located executes the method for integrating the development framework and the web page control described above.
According to another aspect of the present application, there is also provided an electronic device, where the electronic device includes one or more processors and a memory, and the memory is configured to store one or more programs, and where the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the above-described method for integrating a development framework with a web page control.
As can be seen from the above, in the present application, by embedding the target Web page control in the target development framework, where the target development framework is used to access the local file system, registry, and local interface, the target Web page control is used to display and interact Web page content in the native application program, then the target layer and the target structure are built, data type conversion, event transmission, and data exchange between the target development framework and the target Web page control are implemented according to the built target layer, and the request resource loading manner is determined according to the built target structure, i.e. the target development framework and the target Web page control are integrated according to the target layer and the target structure, so as to finally obtain the desktop application program, where the desktop application program not only retains the original advantages of the target development framework, but also introduces the flexibility of the target Web page control, so as to achieve the purpose of integrating the target development framework and the target Web page control, and further solve the technical problems of limitation of the application interface and insufficient local resource utilization of the Web application in the prior art.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1 is a flow chart of an alternative method of integrating a development framework with web page controls in accordance with an embodiment of the application;
FIG. 2 is a block diagram of an alternative method of integrating a development framework with web page controls in accordance with an embodiment of the application;
FIG. 3 is a schematic diagram of an alternative communication through a dynamic bridging layer in accordance with an embodiment of the present application;
FIG. 4 is a flow chart of an alternative intelligent routing system according to an embodiment of the present application;
FIG. 5 is a schematic diagram of an alternative integrated device for developing frameworks and web page controls according to an embodiment of the application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that, the information and data collected by the present application are information and data authorized by the user or fully authorized by each party, and the processes of collecting, storing, using, processing, transmitting, providing, disclosing and applying the relevant data all obey the relevant laws and regulations and standards of the relevant area, take necessary security measures, do not violate the public welcome, and provide corresponding operation entrance for the user to select authorization or rejection. For example, an interface is provided between the system and the relevant user or institution, before acquiring the relevant information, the system needs to send an acquisition request to the user or institution through the interface, and acquire the relevant information after receiving the consent information fed back by the user or institution.
In accordance with an embodiment of the present application, there is provided an embodiment of an integrated method of developing a framework and web page controls, it being noted that the steps illustrated in the flowchart of the figures may be performed in a computer system, such as a set of computer executable instructions, and that, although a logical sequence is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in a different order than that illustrated herein.
It should be noted that, an intelligent integrated system may be used as an execution body of the integration method of the development framework and the web page control according to the embodiment of the present application. It may be understood that the method for integrating the development framework and the web page control provided by the embodiment of the present application may also be implemented by other systems or devices as an execution body, which is not limited in particular by the embodiment of the present application.
FIG. 1 is a flowchart of an alternative method of integrating a development framework with web page controls, as shown in FIG. 1, according to an embodiment of the application, the method comprising the steps of:
step S101, embedding a target webpage control in a target development framework.
In step S101, the target development framework is used to access the local file system, registry, local interface, and the target web page control is used to display and interact web page content in the native application.
Alternatively, the target development framework is an MFC framework, which is a c++ (a programming language) class library for developing Windows applications, and enables rapid development of desktop applications under the Windows operating system. The MFC framework encapsulates the complexity of the Win32 API (Microsoft Windows-bit Application Programming Interface, windows 32-bit application programming interface), enables direct interaction with Windows systems, provides better performance, provides a series of predefined classes to represent common GUI elements (GRAPHICAL USER INTERFACE ELEMENTS ), such as Windows, dialog boxes, and controls, and simplifies the programming effort for message handling and event handling.
Optionally, the target web control is Webview2 (Microsoft Web View, an embedded browser control) that allows embedding a web view based on a Chromium (a browser kernel) open source item in the native application. The WebView2 control supports the latest Web standard, can render complex Web page content, and provides an API (Application Programming Interface ) for interacting with host applications. A developer can integrate Web technology in a desktop application using WebView2 controls to create a hybrid application, thereby combining the performance of the native application with the flexibility of the Web application.
Alternatively, the intelligent integration system first embeds the WebView2 controls in the MFC framework, which typically involves introducing the necessary WebView2 library files and header files in the MFC project, and then creating and initializing the WebView2 controls in the MFC's interface designer or code.
Step S102, constructing a target layer and a target structure.
In step S102, the target layer is configured to process data type conversion, event delivery, and data exchange between the target development framework and the target web page control, and the target structure is configured to determine a resource loading manner.
Optionally, the intelligent integrated system builds a dynamic bridge layer (target layer) and an intelligent routing system (target structure) to enable communication between the MFC and Webview2 and to determine the source of the user request resource.
Optionally, the dynamic bridge layer acts as a bridge for data type conversion and communication protocol differentiation between MFC and WebView2, handling event delivery between the two. For example, passing native user interface events of the MFC to WebView2, or JavaScript events in WebView2 to the MFC, enabling bi-directional exchange of data, enabling MFC components and Web content to share and synchronize data, and so forth. The dynamic bridging layer provides a unified API interface, encapsulates complex WebView2 operation, dynamically adjusts the bridging strategy according to the running environment and application requirements, can remarkably improve the response speed of the application by dynamically adjusting the bridging strategy, and particularly can adjust the bridging strategy according to real-time requirements when complex Web interaction is processed, thereby being applicable to scenes needing highly customized interaction, such as game development, graphic user interface design and the like.
Optionally, the intelligent routing system mainly processes resource loading strategies and safety control, wherein the resource loading strategies comprise determining whether resources, such as HTML, CSS, javaScript, pictures and the like, are loaded locally or acquired from a network, and the safety control mainly comprises the steps of realizing an intelligent caching mechanism, optimizing resource loading speed and efficiency, and carrying out safety inspection on requests to prevent potential safety threats.
Optionally, the intelligent routing system may further include an algorithm for automatically switching caching policies to accommodate different network environments. The algorithm can intelligently select the most suitable resource loading mode according to the network condition, reduces the influence of network delay on the application performance, and is suitable for application scenes such as mobile office software, online collaboration platforms and the like with unstable network conditions or frequent change of resource requirements.
And step S103, integrating the target development framework and the target webpage control according to the target layer and the target structure to obtain the target application program.
Optionally, the intelligent integrated system integrates the MFC framework and WebView2 control according to the dynamic bridging layer and the intelligent routing system, and finally obtains the desktop application program.
Optionally, fig. 2 is a block diagram of an alternative method for integrating a development framework with Web page controls according to an embodiment of the present application, where, as shown in fig. 2, three phases are involved in the process of integrating the development framework with Web page controls, the first phase is an MFC initialization phase, where an MFC application will set its basic operating environment, such as initializing Windows and MFC libraries, creating a main window, etc., the second phase is a WebView2 processing phase, where WebView2 is introduced and used for rendering Web content, and the phase mainly includes four modules, respectively, a dynamic bridge layer, an intelligent routing system, resource management, and WebView2 content preparation, the dynamic bridge layer is a communication intermediary between the MFC and WebView2, and is responsible for handling data type conversion, protocol differences, and bidirectional transfer of events and data, the intelligent routing system is responsible for resource loading policies and security control, the resource management is used for managing data resources, the WebView2 content preparation is used for rendering the Web content, and the third phase is a unified dialog content (MFC is a mixed with the Web view control, and the Web view is rendered in the final view (the Web view is a unified view control is a unified view) interface) of the Web page 25).
As can be seen from the contents of steps S101 to S103, in the present application, a target web page control is first embedded in a target development framework, where the target development framework is used to access a local file system, a registry and a local interface, the target web page control is used to display and interact web page content in a native application program, then a target layer and a target structure are constructed, where the target layer is used to process data type conversion, event transmission and data exchange between the target development framework and the target web page control, the target structure is used to determine a resource loading mode, and finally the target development framework and the target web page control are integrated according to the target layer and the target structure to obtain a target application program.
As can be seen from the above, in the present application, by embedding the target Web page control in the target development framework, where the target development framework is used to access the local file system, registry, and local interface, the target Web page control is used to display and interact Web page content in the native application program, then the target layer and the target structure are built, data type conversion, event transmission, and data exchange between the target development framework and the target Web page control are implemented according to the built target layer, and the request resource loading manner is determined according to the built target structure, i.e. the target development framework and the target Web page control are integrated according to the target layer and the target structure, so as to finally obtain the desktop application program, where the desktop application program not only retains the original advantages of the target development framework, but also introduces the flexibility of the target Web page control, so as to achieve the purpose of integrating the target development framework and the target Web page control, and further solve the technical problems of limitation of the application interface and insufficient local resource utilization of the Web application in the prior art.
In an alternative embodiment, the intelligent integrated system constructs the target layer according to a first communication mode, a second communication mode and a third communication mode, wherein the first communication mode is used for realizing unidirectional communication between the target development framework and the target webpage control, the second communication mode is used for realizing bidirectional communication between the target development framework and the target webpage control, the third communication mode is used for processing data transmission between the target development framework and the target webpage control, and then the target structure is determined according to a resource loading strategy and a page display mode, the resource loading strategy is used for determining sources of data resources, and the page display mode is used for determining a switching mode between pages.
Optionally, the intelligent integrated system builds a dynamic bridge layer according to PostMessage communication (first communication mode), hostObjects communication (second communication mode) and shared memory communication (third communication mode), which enables the system to flexibly process communication and data transmission between MFC framework and WebView 2.
Alternatively, postMessage communication is applicable to simple interactive scenarios, without the need to get a return result. For example, a user operation event, such as clicking a button, is sent from the MFC framework to WebView2, but specific processing results are not required to be returned by WebView2, and the communication mode realizes simple and unidirectional data transmission, which has the advantages of being lightweight and suitable for frequent interaction, reducing unnecessary processing overhead, hostObjects communication is suitable for a complex interaction scene requiring return results, the mechanism supports bidirectional communication, so that interaction between the MFC framework and WebView2 is more flexible and rich, shared memory communication is used for processing high-efficiency transmission of large data volume, and when processing large data volume, the conventional serialization and deserialization processes consume a large amount of time and computational resources, and can share memory between the MFC framework and WebView2 in a shared memory communication mode to directly transmit data, thereby avoiding the cost of serialization and deserialization, and remarkably improving the efficiency and speed of data transmission.
Optionally, the intelligent integrated system can flexibly select and apply three communication modes, namely PostMessage communication, hostObjects communication and shared memory communication, according to different communication requirements and data transmission characteristics, so as to realize efficient communication between the MFC framework and WebView 2.
Optionally, fig. 3 is a schematic diagram of an alternative communication through a dynamic bridge layer according to an embodiment of the present application, as shown in fig. 3, at a back end of the MFC, the MFC component is connected through the dynamic bridge layer, and a communication channel connected by the dynamic bridge layer has three communication modes, namely, postMessage communication, hostObjects communication and shared memory communication, through which communication between the MFC component and the WebView2 control is implemented.
Optionally, the intelligent integrated system determines the intelligent routing system according to a resource loading policy and a page display mode, where the resource loading policy is used to determine whether a source of a data resource is loaded from a local cache or not, or is obtained from a remote server, and the page display mode relates to a switching mechanism between pages, for example, a hash routing technology is adopted to implement front-end page navigation, and the switching mode of the page does not trigger page refreshing, which is beneficial to improving application performance and user experience.
From the above, it can be seen that, by introducing three different communication modes, the intelligent integrated system can adapt to various development scenarios and requirements, so as to improve flexibility and adaptability of communication, and by using a special data transmission communication mode, the system can better protect safety and integrity of data, and in addition, by using a resource loading strategy and an intelligent decision of a page display mode, the system can provide smoother and more intuitive user experience, and a developer can realize complex interactive functions more easily and more quickly, so that development efficiency is improved.
In an alternative embodiment, the intelligent integrated system obtains a first calling method and a second calling method, wherein the first calling method is used for transmitting information from the target development framework to the target webpage control, the second calling method is used for transmitting information from the target webpage control to the target development framework, then a first communication mode is determined according to the first calling method and the second calling method, then a third calling method is obtained, the third calling method is used for opening the calling authority of a function object in the target development framework to the target webpage control, then a second communication mode is determined according to the third calling method, then a fourth calling method is obtained, wherein the fourth calling method is used for establishing a shared memory channel between the target development framework and the target webpage control, and then the third communication mode is determined according to the fourth calling method.
Alternatively, a first calling method is PostWebMessageAsJson methods for sending messages from MFC to WebView2, when this method is called, a string in JSON format (JavaScript Object Notation ) may be passed as parameters, which includes data intended to be sent to the Web page, for example, notifying the Web page of a user operation, or sending some initialization data, which may be used, and a second calling method is a window.chrome.postmessage method, which is located in the JavaScript environment, for sending messages from the Web page of WebView2 to the host application (here MFC application), in the JavaScript code of the Web page, sending data using the window.chrome.postmessage method, which receives a parameter, typically a JavaScript object, which is serialized into a JSON string, and then passed to the application.
Optionally, in the MFC application, when data needs to be sent to the Web page, a PostWebMessageAsJson method is called to send the data in JSON format, and in JavaScript of the Web page, the window.
Optionally, the third calling method is AddHostObjectToScript method, which is a mechanism provided by WebView2 for using native (c++) code in JavaScript, by which a name can be defined in JavaScript, then a reference to a c++ object can be associated with this name, after which in JavaScript code of a Web page the member function of the c++ object can be called by this name, even accessing certain member variables.
Optionally, the fourth calling method is PostSharedBufferToScript, which is also a method provided by WebView2, and in brief, the method is used for transmitting a shared memory buffer area to JavaScript, so that the JavaScript can directly access the shared memory buffer area in the browser rendering process without carrying out serialization and deserialization of data, and the data transmission speed and efficiency are greatly improved.
From the above, it can be seen that the intelligent integrated system realizes unidirectional communication between the Web page and the MFC application program according to PostWebMessageAsJson method and window. Chrome. Webview. Postmessage method, realizes bidirectional communication between the Web page and the MFC application program according to AddHostObjectToScript method, and can realize the condition of processing a large amount of data between the Web page and the MFC application program according to PostSharedBufferToScript method, and by means of the three communication methods, realizes efficient integration and communication between the MFC framework and the Webview2 control, which not only improves application performance and user experience, but also ensures safety and flexibility of data exchange.
In an alternative embodiment, the intelligent integrated system creates an objective function object in the process of determining the second communication mode according to the third calling method, wherein the objective function object comprises a plurality of function processing methods and function attributes, and then registers the objective function object in the target webpage control according to the third calling method.
Alternatively, the AddHostObjectToScript method allows exposing the native object (typically C++) to JavaScript code in WebView2, thereby enabling two-way communication between the two. In popular terms, a direct communication channel is established between the MFC application program and the embedded Webview2 environment, so that the MFC application can directly control Web content, and the Web content can also call methods in the MFC application or access properties thereof.
Optionally, the intelligent integration system first needs to create a c++ class meeting WebView2 bridging requirements, the class is encapsulated into objects that can be invoked by JavaScript, and then adds this c++ class instance to the context of WebView2 through AddHostObjectToScript methods, so that in WebView 2-loaded web pages, this c++ object can be accessed through a specific namespace and object name, thereby invoking its method or acquiring its attributes, and at the same time, an event handler can be defined in the c++ object, so that when a specific JavaScript event triggers, the MFC application can receive these events and respond.
According to the above, the intelligent integrated system can use the C++ object and the method and attribute thereof for WebView2 according to the third calling method, so that bidirectional communication between the C++ object and the method and attribute thereof is realized, the intelligent integrated system is suitable for a scene requiring real-time interaction and result feedback, and more direct and more efficient data processing and interaction experience can be provided.
In an optional embodiment, the intelligent integrated system creates a shared memory buffer area in the target development framework, and then acquires a target interface, wherein the target interface is used as a target web page control to access an access channel of the shared memory buffer area, and finally, a third communication mode is determined according to the shared memory buffer area, the fourth calling method and the target interface.
Optionally, the intelligent integrated system firstly needs to create a shared memory buffer area at the c++ end, fill data to be transmitted, then uses PostSharedBufferToScript method to transfer the buffer area to JavaScript, accesses the shared memory buffer area at the JavaScript end through a specific API (such as window.
From the above, it can be seen that the intelligent integrated system avoids the serialization and anti-serialization process of data between c++ and JavaScript through the shared memory communication mode, significantly reduces the data transmission delay, and improves the efficiency of large data volume transmission, thereby enhancing the interaction speed between Webview2 and MFC, improving the user experience, and by creating the shared memory buffer region in the MFC layer, the system can locally store and quickly access common or large data, avoiding frequent network requests and resource loading, reducing bandwidth consumption, and enhancing the application responsiveness and offline capability.
In an alternative embodiment, the intelligent integrated system firstly acquires the resource request, then judges whether the target resource corresponding to the resource request belongs to the resource in the local cache, checks whether the version of the target resource is the latest version if the target resource is determined to belong to the resource in the local cache, outputs the target resource if the version of the target resource is the latest version, acquires the latest version of the resource from the network if the version of the target resource is not the latest version, updates the latest version of the resource into the local cache, outputs the latest version of the resource from the local cache, acquires the target resource from the network if the target resource is not the resource in the local cache, updates the target resource into the local cache, and outputs the target resource.
Alternatively, the intelligent routing system receives all user requests and decides how to handle them and classifies the requests into two categories, front-end requests and resource requests. FIG. 4 is a flowchart of an alternative intelligent routing system according to an embodiment of the present application, as shown in FIG. 4, after a user request is obtained, it is first determined whether the user request is a resource request or a front-end request, if the user request is a front-end request, a corresponding page is switched according to the user request, if the user request is a resource request, it is first determined whether the requested resource exists locally, if the resource exists locally, it is checked whether a version of the resource is the latest version, it is determined whether the resource needs to be updated according to the checking result, if the resource is not the latest version, the latest version corresponding to the resource is retrieved from the network and updated into a local cache, then the resource is loaded from the local cache and returned, if the resource is the latest version, the resource is directly loaded from the local and returned, if the resource does not exist locally, the resource is directly loaded from the network and cached locally, and finally the resource is returned.
According to the above, the intelligent integrated system realizes high efficiency, safety and flexibility of resource loading through intelligent caching, version inspection and network resource management, effectively improves the performance and user experience of the high-efficiency Webview2 integrated system and method based on the MFC framework, and simultaneously ensures the latest and consistency of resources.
In an alternative embodiment, the intelligent integrated system first acquires a target method, wherein the target method is used for preloading data resources in a target webpage control, then in the process of starting a target application program, preloading data resources with the use frequency exceeding a first preset threshold according to the target method, configuring a delayed loading strategy and an operation caching strategy, wherein the delayed loading strategy is used for delaying loading of first-class data resources and second-class data resources, the first-class data resources are data resources which do not affect normal starting of the target application program, the second-class data resources are data resources which are irrelevant to processing of user requests, and the operation caching strategy is used for caching historical data resources which are already loaded by the target webpage control.
Alternatively, the target method is NavigateToString methods, which is one provided in WebView 2. Some common resources, such as HTML, CSS or JavaScript code, are preloaded by using NavigateToString methods when the application is started, so that the loading time of subsequent operations is reduced.
Optionally, the delayed loading policy delays loading of non-critical resources (such as pictures, videos, javaScript scripts, etc.) until the initial loading of the page is completed, or only when the user actually needs to view or use the resources, so that the loading time when the user opens the page for the first time can be significantly reduced by delaying loading of the non-critical resources, because the browser or the application only needs to load the most basic resources, such as page structures and core styles, constituting the first screen display, which makes the page or the application start faster and improves the user experience.
Optionally, running the caching policy allows the browser control (WebView 2 control) to locally store network resources that have been loaded so that they can be read directly from the cache when the same resource is subsequently requested, without downloading again from the network. The application of the caching mechanism of the WebView2 can greatly shorten the resource loading time and avoid repeated network requests, thereby improving the page loading speed and the overall performance of the WebView2 component.
From the above, it can be seen that the intelligent integrated system significantly improves the starting speed and responsiveness of the application program by preloading common resources and delaying loading non-critical resources, improves the overall user experience, reduces network transmission and resource repeated loading by running a caching strategy, reduces the complexity of resource management, improves the resource utilization efficiency, and enhances the offline operation capability of the application program.
According to another aspect of the embodiment of the application, an embodiment of an integrated device for developing a framework and a web page control is also provided. Fig. 5 is a schematic diagram of an alternative integrated device for developing a frame and a web page control according to an embodiment of the present application, and as shown in fig. 5, the integrated device for developing a frame and a web page control includes an embedding unit 501, a building unit 502, and an integrating unit 503.
Optionally, an embedding unit 501 is configured to embed a target web page control in a target development framework, where the target development framework is configured to access a local file system, a registry, and a local interface, the target web page control is configured to display and interact web page content in a native application, a building unit 502 is configured to build a target layer and a target structure, where the target layer is configured to process data type conversion, event delivery, and data exchange between the target development framework and the target web page control, and the target structure is configured to determine a resource loading manner, and an integrating unit 503 is configured to integrate the target development framework and the target web page control according to the target layer and the target structure, so as to obtain the target application.
Optionally, the construction unit 502 includes a first construction subunit and a first determination subunit. The system comprises a target development framework, a target webpage control, a first construction subunit, a first determination subunit and a page display mode, wherein the first construction subunit is used for constructing a target layer according to a first communication mode, a second communication mode and a third communication mode, the first communication mode is used for realizing unidirectional communication between the target development framework and the target webpage control, the second communication mode is used for realizing bidirectional communication between the target development framework and the target webpage control, the third communication mode is used for processing data transmission between the target development framework and the target webpage control, the first determination subunit is used for determining a target structure according to a resource loading strategy and the page display mode, the resource loading strategy is used for determining sources of data resources, and the page display mode is used for determining a switching mode between pages.
Optionally, the first construction subunit comprises a first acquisition module, a first determination module, a second acquisition module, a second determination module, a third acquisition module and a third determination module. The system comprises a first acquisition module, a first determination module, a second acquisition module and a third determination module, wherein the first acquisition module is used for acquiring a first calling method and a second calling method, the first calling method is used for transmitting information from a target development framework to a target webpage control, the second calling method is used for transmitting information from the target webpage control to the target development framework, the first determination module is used for determining a first communication mode according to the first calling method and the second calling method, the second acquisition module is used for acquiring a third calling method, the third calling method is used for opening the calling authority of a function object in the target development framework to the target webpage control, the second determination module is used for determining a second communication mode according to the third calling method, the third acquisition module is used for acquiring a fourth calling method, and the fourth calling method is used for establishing a shared memory channel between the target development framework and the target webpage control.
Optionally, the integrated device for developing the framework and the webpage control further comprises a creation unit and a registration unit. The system comprises a first call method, a second call method, a creation unit and a registration unit, wherein the creation unit is used for creating a target function object in the process of determining the second communication mode according to the third call method, the target function object comprises a plurality of function processing methods and function attributes, and the registration unit is used for registering the target function object in a target webpage control according to the third call method.
Optionally, the third determining module comprises a first creating sub-module, a first obtaining sub-module and a first determining sub-module. The system comprises a target development framework, a first creation submodule, a first acquisition submodule and a first determination submodule, wherein the first creation submodule is used for creating a shared memory buffer area in the target development framework, the first acquisition submodule is used for acquiring a target interface, the target interface is used for accessing an access channel of the shared memory buffer area as a target webpage control, and the first determination submodule is used for determining a third communication mode according to the shared memory buffer area, a fourth calling method and the target interface.
Optionally, the first determining subunit comprises a fourth obtaining module, a first judging module, a first checking module, a first output module, a second output module and a third output module. The system comprises a first acquisition module for acquiring a resource request, a first judgment module for judging whether a target resource corresponding to the resource request belongs to a resource in a local cache, a first check module for checking whether the version of the target resource is the latest version or not under the condition that the target resource is determined to belong to the resource in the local cache, a first output module for outputting the target resource under the condition that the version of the target resource is the latest version, a second output module for acquiring the resource of the latest version from a network and updating the resource of the latest version into the local cache under the condition that the version of the target resource is not the latest version, and outputting the resource of the latest version from the local cache, and a third output module for acquiring the target resource from the network, updating the target resource into the local cache and outputting the target resource under the condition that the target resource does not belong to the resource in the local cache.
Optionally, the integrated device for developing the framework and the webpage control further comprises an acquisition unit, a processing unit and a configuration unit. The system comprises an acquisition unit, a processing unit and a configuration unit, wherein the acquisition unit is used for acquiring a target method, the target method is used for preloading data resources in a target webpage control, the processing unit is used for preloading data resources with the use frequency exceeding a first preset threshold value according to the target method in the process of starting a target application program, the configuration unit is used for configuring a delayed loading strategy and an operation caching strategy, the delayed loading strategy is used for delaying loading of first-class data resources and second-class data resources, the first-class data resources are data resources which do not influence normal starting of the target application program, the second-class data resources are data resources which are irrelevant to processing user requests, and the operation caching strategy is used for caching history data resources which are already loaded by the target webpage control.
According to another aspect of the present application, there is further provided a computer readable storage medium, where a computer program is stored in the computer readable storage medium, where when the computer program runs, a device where the computer readable storage medium is located executes the above-mentioned method for integrating a development framework and a web page control.
According to another aspect of the present application, there is also provided an electronic device, where the electronic device includes one or more processors and a memory, where the memory is configured to store one or more programs, and where the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the above-described method of integrating a development framework with a web page control.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, for example, may be a logic function division, and may be implemented in another manner, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. The storage medium includes a U disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, etc. which can store the program code.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application, which are intended to be comprehended within the scope of the present application.

Claims (10)

1. An integration method of a development framework and a webpage control is characterized by comprising the following steps:
embedding a target webpage control in a target development framework, wherein the target development framework is used for accessing a local file system, a registry and a local interface, and the target webpage control is used for displaying and interacting webpage content in a native application program;
Constructing a target layer and a target structure, wherein the target layer is used for processing data type conversion, event transmission and data exchange between the target development framework and the target webpage control, and the target structure is used for determining a resource loading mode;
And integrating the target development framework and the target webpage control according to the target layer and the target structure to obtain a target application program.
2. The method of claim 1, wherein constructing the target layer and the target structure comprises:
Constructing the target layer according to a first communication mode, a second communication mode and a third communication mode, wherein the first communication mode is used for realizing one-way communication between the target development framework and the target webpage control, the second communication mode is used for realizing two-way communication between the target development framework and the target webpage control, and the third communication mode is used for processing data transmission between the target development framework and the target webpage control;
And determining the target structure according to a resource loading strategy and a page display mode, wherein the resource loading strategy is used for determining the source of the data resource, and the page display mode is used for determining the switching mode among pages.
3. The method of claim 2, wherein before constructing the target layer according to the first communication manner, the second communication manner, and the third communication manner, the method of integrating the development framework with the web page control further comprises:
Acquiring a first calling method and a second calling method, wherein the first calling method is used for transmitting information from the target development framework to the target webpage control, and the second calling method is used for transmitting information from the target webpage control to the target development framework;
Determining the first communication mode according to the first calling method and the second calling method;
Acquiring a third calling method, wherein the third calling method is used for opening the calling authority of the function object in the target development framework to the target webpage control;
Determining the second communication mode according to the third calling method;
acquiring a fourth calling method, wherein the fourth calling method is used for establishing a shared memory channel between the target development framework and the target webpage control;
And determining the third communication mode according to the fourth calling method.
4. The method for integrating a development framework with a web page control according to claim 3, further comprising:
Creating an objective function object in the process of determining the second communication mode according to the third calling method, wherein the objective function object comprises a plurality of function processing methods and function attributes;
And registering the target function object into the target webpage control according to the third calling method.
5. The method for integrating a development framework with a web page control according to claim 3, wherein determining the third communication mode according to the fourth calling method comprises:
Creating a shared memory cache region in the target development framework;
acquiring a target interface, wherein the target interface is used as an access channel for accessing the shared memory cache area by the target webpage control;
And determining the third communication mode according to the shared memory buffer area, the fourth calling method and the target interface.
6. The method for integrating a development framework with a web page control according to claim 2, wherein the resource loading strategy is obtained by the steps of:
Acquiring a resource request;
Judging whether the target resource corresponding to the resource request belongs to a resource in a local cache;
Checking whether the version of the target resource is the latest version or not under the condition that the target resource is determined to belong to the resource in the local cache;
outputting the target resource under the condition that the version of the target resource is the latest version;
Under the condition that the version of the target resource is not the latest version, acquiring the latest version of the resource from a network, updating the latest version of the resource into the local cache, and outputting the latest version of the resource from the local cache;
And under the condition that the target resource does not belong to the resource in the local cache, acquiring the target resource from the network, updating the target resource into the local cache, and outputting the target resource.
7. The method for integrating a development framework with a web page control according to claim 1, wherein the method for integrating a development framework with a web page control further comprises:
Acquiring a target method, wherein the target method is used for preloading data resources in the target webpage control;
In the process of starting the target application program, preloading data resources with the use frequency exceeding a first preset threshold according to the target method;
And configuring a delayed loading strategy and an operation caching strategy, wherein the delayed loading strategy is used for delaying loading of first-class data resources and second-class data resources, the first-class data resources are data resources which do not influence the normal starting of the target application program, the second-class data resources are data resources irrelevant to processing user requests, and the operation caching strategy is used for caching the history data resources loaded by the target webpage control.
8. An integrated device for developing a framework and a web page control, comprising:
the embedded unit is used for embedding a target webpage control in a target development framework, wherein the target development framework is used for accessing a local file system, a registry and a local interface, and the target webpage control is used for displaying and interacting webpage content in a native application program;
The building unit is used for building a target layer and a target structure, wherein the target layer is used for processing data type conversion, event transmission and data exchange between the target development framework and the target webpage control, and the target structure is used for determining a resource loading mode;
And the integration unit integrates the target development framework and the target webpage control according to the target layer and the target structure to obtain a target application program.
9. A computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, and when the computer program runs, the computer readable storage medium is caused to execute the method for integrating the development framework and the web page control according to any one of claims 1 to 7.
10. An electronic device comprising one or more processors and memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of integrating a development framework with web page controls of any of claims 1-7.
CN202411701572.2A 2024-11-25 2024-11-25 Development framework and web page control integration method and device Pending CN119806517A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411701572.2A CN119806517A (en) 2024-11-25 2024-11-25 Development framework and web page control integration method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411701572.2A CN119806517A (en) 2024-11-25 2024-11-25 Development framework and web page control integration method and device

Publications (1)

Publication Number Publication Date
CN119806517A true CN119806517A (en) 2025-04-11

Family

ID=95272203

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411701572.2A Pending CN119806517A (en) 2024-11-25 2024-11-25 Development framework and web page control integration method and device

Country Status (1)

Country Link
CN (1) CN119806517A (en)

Similar Documents

Publication Publication Date Title
JP5439190B2 (en) Method and system for creating server-based web applications for IT
RU2304305C2 (en) Systems and methods for controlling drivers in a computer system
US10261845B2 (en) Transparent integration of application components
JP5805867B2 (en) Remote browsing session management
AU2009246884B2 (en) Multi-process browser architecture
US20030025728A1 (en) User control objects for providing server-side code generation from a user-defined dynamic web page content file
US8255921B2 (en) Method and apparatus that enables a web-based client-server application to be used offline
US7607128B2 (en) Method and system for enabling a server application to be executed in the same virtual machine as a client application using direct object oriented programming method calls
EP1727041A2 (en) Pipeline architecture for use with net-centric application program architectures
KR20030045027A (en) Accessing legacy applications from the internet
WO2002033545A2 (en) Pluggable instantiable distributed objects
CA2979622A1 (en) Remote process execution management
AU2002319843A1 (en) General and reusable components for defining net-centric application program architectures
WO2009155178A1 (en) System and method for dynamic partitioning of applications in client-server environments
US20130073601A1 (en) Remote process execution management
US11023558B1 (en) Executing functions on-demand on a server utilizing web browsers
US20140059172A1 (en) Remote portlet consumer with enhanced resource url processing
US20220043546A1 (en) Selective server-side rendering of scripted web page interactivity elements
US20100229081A1 (en) Method for Providing a Navigation Element in an Application
CA2599893A1 (en) Method and apparatus to select and deliver portable portlets
US9830307B1 (en) Ahead of time compilation of content pages
JP2006195979A (en) Web application architecture
US20140359429A1 (en) Method, computer program, and system for rearranging a server response
CN119806517A (en) Development framework and web page control integration method and device
WO2023124657A1 (en) Micro-application running method and apparatus, device, storage medium, and program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination