Method, system and equipment for developing nested application program and storage medium

Nested management of WebView2 and Unreal Engine windows through the HwndHost class realizes seamless integration of WebView2 and Unreal Engine in WPF applications, solves the problems of incoherent user experience and limited interaction, improves interactivity and rendering performance, and supports cross-platform Security developed and enhanced.

CN118733032APending Publication Date: 2024-10-01YAOMO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410849344.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

When existing WPF applications display web content and game rendering results, the user experience is incoherent. The interaction between web content and game rendering results is limited, making it difficult to achieve smooth data transmission and operation synchronization.

Method used

Use the HwndHost class to nestly manage the WebView2 control and the Unreal Engine rendering window. Load the web page content through the WebView2 control and pass the instructions to the Unreal Engine program to achieve seamless integration and efficient interaction between WPF, WebView2 and Unreal Engine. Set the WebView2 control Make the background transparent, creating a window with no borders and a transparent background.

Benefits of technology

Improves application interactivity and rendering performance, provides a smoother and integrated user experience, reduces operational complexity, supports cross-platform development, allows for a consistent experience on different operating systems, and enhances application security sex.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733032A_ABST
    Figure CN118733032A_ABST
Patent Text Reader

Abstract

The invention discloses a nested application program development method, system and device and a storage medium, and relates to the field of computer software development. In the method, a WebView2 control is integrated, the background of the WebView2 control is set to be transparent, and a window without a frame and with the transparent background is created; a HwndHost class is used for nesting and managing a rendering window of a WebView2 control and a rendering window of a Unreal Engine program; loading the content of the preset webpage through the WebView2 control, and displaying the content in a window; and when an instruction input by a preset webpage is received, sending the instruction to the Unreal Engine program, and displaying a rendering result of executing the instruction by the Unreal Engine program through the rendering window. By implementing the technical scheme provided by the invention, seamless integration and efficient interaction among a plurality of programs are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of computer software development, and in particular to a method, system, electronic device and storage medium for developing nested application programs. Background Art

[0002] With the continuous development of computer technology, various application development frameworks and technologies continue to emerge to meet the diverse needs of users. Among them, WPF (Windows Presentation Foundation) is a powerful desktop application development framework that is widely used in software development on the Windows platform.

[0003] In existing technical solutions, WPF applications usually display Web (webpage) content and game rendering results through independent windows. Although this method is simple and direct, users need to switch between different windows when using it, which affects the consistency of user experience. In addition, the interaction between Web content and game rendering results is often limited by different window environments, making it difficult to achieve smooth data transmission and operation synchronization.

[0004] Therefore, how to achieve efficient integration of WebView2 controls and Unreal Engine rendering windows in WPF applications, improve user experience, and reduce operation complexity has become a technical problem that needs to be solved urgently. Summary of the invention

[0005] The present application provides a method, system, device and storage medium for developing nested application programs, which adopts HwndHost class to nestly manage WebView2 control and Unreal Engine rendering window, realizes seamless integration and efficient interaction between WPF, WebView2 and UnrealEngine, and improves the interactivity and rendering performance of the application program.

[0006] In a first aspect of the present application, a method for developing a nested application is provided, which is applied to a WPF application. The method comprises: Integrate the WebView2 control, set the background of the WebView2 control to be transparent, and create a window with no border and transparent background; Use the HwndHost class to nest and manage the WebView2 control and the rendering window of the Unreal Engine program; Loading the content of a preset web page through the WebView2 control and displaying the content in the window; When receiving the instruction inputted from the preset webpage, the instruction is sent to the Unreal Engine program, and the rendering result of the Unreal Engine program executing the instruction is displayed through the rendering window.

[0007] By adopting the above technical solution and using the WebView2 control to load web content, users can directly access and interact with web pages in WPF applications without opening a browser, thus providing a smoother and more integrated user experience. Setting the background of the WebView2 control to transparent and creating a borderless window can make the application interface more modern and beautiful, while providing more flexible layout options. Using the HwndHost class to manage the WebView2 control and the UnrealEngine rendering window can effectively share and coordinate the resources of both, reduce memory usage and improve performance. When the WebView2 control receives input instructions from a preset web page, it can instantly pass these instructions to the Unreal Engine program and display the execution results through the rendering window, which provides users with fast feedback and interactive experience. Since both the WebView2 control and the Unreal Engine support cross-platform development, this method can enable WPF applications to provide a consistent experience on different operating systems. Unreal Engine is known for its powerful 3D rendering capabilities. With this method, WPF applications can integrate complex 3D scenes and animations to provide a richer visual experience. This method allows developers to easily expand or modify the functionality of the application as needed, such as adding new web content or adjusting the rendering effects of the Unreal Engine.

[0008] Optionally, the integrated WebView2 control includes: Use the NuGet package manager to install the WebView2 control into the WPF application, and add a declaration of the WebView2 control in the WPF application to reference the WebView2 control; Initialize the WebView2 control, and set the source property of the WebView2 control to the uniform resource locator of the preset web page.

[0009] By adopting the above technical solution, the WebView2 control is installed using the NuGet package manager, which simplifies the process of manually downloading and integrating controls, allowing developers to quickly start project development. Using NuGet can ensure that all developers and build environments use the same version of the WebView2 control, reducing problems caused by inconsistent versions. The NuGet package manager provides dependency management and automatic update functions, making it easier to maintain and update the WebView2 control. By setting the source property of the WebView2 control to the URL of a preset web page, the application can quickly load and display web page content without the user manually entering the URL. The WebView2 control provides a variety of security features, such as script isolation and enhanced privacy protection, which can improve the security of the application. The WebView2 control supports the latest web standards and technologies, such as HTML5, CSS3, and JavaScript, allowing WPF applications to use these technologies to provide a rich interactive experience. By declaring and referencing the WebView2 control, developers can use the control directly in XAML, simplifying code writing and improving development efficiency. This method allows developers to embed web pages in WPF applications, realize hybrid development of web and local applications, and provide more development possibilities. The integration of the WebView2 control enables developers to design more flexible and dynamic user interfaces in WPF applications, combining the rich content of web pages with WPF's native UI controls.

[0010] Optionally, setting the background of the WebView2 control to be transparent includes: The rendering content of the web page is captured using the application program interface of the WebView2 control, and the rendering content is displayed as a transparent image or layer in the WPF application.

[0011] By adopting the above technical solutions, setting a transparent background allows the content of the WebView2 control to blend seamlessly with the UI elements of the WPF application, providing a more unified and coordinated interface experience. Developers can design the interface of the application more freely because the WebView2 control can adapt to any background, including complex graphics or animations. Users can more intuitively see the interaction between the web page content and the rest of the application, enhancing the overall user experience. The transparent background enables the WebView2 control to be placed in any complex layout, including irregular shapes or areas with other controls. By capturing the rendered content and displaying it as an image or layer, the dependence on the WebView2 control itself can be reduced, which may help improve the performance of the application. The WebView2 control with a transparent background can be combined with other WPF controls or animation effects to achieve richer dynamic interactions. Allows developers to design multi-level user interfaces, in which the content of the WebView2 control can be displayed as the top or bottom layer, superimposed with other UI elements. Capturing and displaying the rendered content through the application interface simplifies the process of integrating and displaying the WebView2 control in WPF. Processing the rendered content as an image or layer can make the integration of the WebView2 control more modular, facilitating future maintenance and updates. Developers can perform custom processing on the captured rendering content, such as resizing, applying filters, or performing other image processing operations.

[0012] Optionally, creating a window without borders and with a transparent background includes: Set the WindowStyle property to None to remove the standard border and set the Background property to Transparent to make the background transparent.

[0013] By adopting the above technical solutions, developers can fully control the appearance of the window and achieve highly customized interface design. Transparent background allows the window content to seamlessly integrate with the background of the desktop or other applications, providing a more immersive user experience. Borderless windows can provide more modern and smooth visual effects, especially when designing applications with animations or special backgrounds. Developers can flexibly adjust the shape and size of the window according to the needs of the application, and even create non-rectangular windows. Users can interact with the window content more intuitively, especially when the window content needs to cover other applications or desktop elements. Transparent background allows windows to adapt to more complex layout requirements, including irregular shapes or alignment with specific desktop areas. Borderless windows reduce visual interference, allowing users to focus more on the content within the window. Windows can display content dynamically, such as video, animation, or real-time data, without being restricted by traditional window borders. In some cases, custom windows may reduce the demand for system resources because they do not contain standard window decoration elements. Borderless and transparent background windows can be used to implement special functions, such as creating tooltips, pop-up windows, or other auxiliary interface elements. In some application scenarios, borderless windows can reduce users' misunderstanding of window operations, thereby reducing the risk of accidental closure or misoperation.

[0014] Optionally, the nested management of the WebView2 control and the rendering window of the Unreal Engine program using the HwndHost class includes: Create a derived class inherited from HwndHost, and associate the first window handle of the WebView2 control with the second window handle of the HwndHost according to the derived class; Obtaining a rendering window handle from the Unreal Engine program, and setting the rendering window handle through the derived class; Pass messages or use inter-process communication between the WPF application and the Unreal Engine program to maintain synchronization.

[0015] By adopting the above technical solutions, it is possible to integrate Web-based controls (WebView2) and high-performance 3D rendering engines (Unreal Engine) into the same WPF application to achieve technology integration. Through the class derived from HwndHost, a unified communication mechanism can be established to enable WPF applications to interact with WebView2 controls and UnrealEngine programs. By directly managing the rendering window handle, the rendering process can be optimized and the performance loss during the rendering process can be reduced. The WebView2 control and the Unreal Engine rendering window can be seamlessly integrated into the UI (User Interface) of the WPF application, providing a richer and more dynamic user experience. Through the HwndHost class, window handles can be managed more flexibly to achieve complex window layouts and interactive effects. Through the inter-process communication (IPC) mechanism, data synchronization and state sharing between WPF applications and Unreal Engine programs can be achieved. By optimizing message passing and IPC, the response speed and interaction fluency of the application can be improved. Complex interaction logic can be built so that user operations can be passed between the WPF interface, WebView2 controls, and Unreal Engine rendering windows. By controlling message passing and IPC, you can better manage data flow and improve application security. With the HwndHost class, developers can more efficiently develop and maintain WPF applications that integrate WebView2 and Unreal Engine. Combining the Web content display capabilities of the WebView2 control with the advanced visual effects of Unreal Engine, you can create highly attractive application interfaces. WPF applications can dynamically update the content of the WebView2 control and the rendering output of UnrealEngine based on user interactions or external events.

[0016] Optionally, the method further includes: Define a first function that can be called by a front-end program in a WPF application, and use the WebView2 control to inject JavaScript code into the preset web page so that the preset web page calls the first function through the JavaScript code; A second function that needs to be called by the WPF application is defined in the preset web page, and a preset object is set in the WebView2 control so that the WPF application calls the second function through the preset object.

[0017] By adopting the above technical solution, a two-way communication mechanism between the WPF application and the preset web page is implemented, allowing the two to call each other's functions. Through JavaScript code bridging, the web front end can interact with the back-end logic of the WPF application more flexibly. Allow developers to share and reuse code between WPF applications and web front ends to improve development efficiency. The process of integrating web page functions into WPF applications is simplified through preset objects and injected JavaScript code. Users can use web page functions seamlessly in WPF applications without leaving the application environment. Using JavaScript and Web API, modern web technologies such as WebGL, WebSockets, etc. can be accessed and implemented. WPF applications can dynamically update or interact with web page content as needed to provide a dynamic user interface. By controlling the injection of JavaScript code and the setting of preset objects, security can be managed to a certain extent to avoid potential cross-site scripting attacks (XSS). Since JavaScript is a widely supported language, this approach helps to improve the compatibility of applications on different platforms. Allow complex business logic to be distributed between WPF applications and web front ends, and handle them according to their respective advantages.

[0018] Optionally, the method further includes: A Socket client is created in the WPF application and connected to the Socket server provided by the Unreal Engine program to achieve communication between the WPF application and the Unreal Engine program.

[0019] By adopting the above technical solutions, Socket communication allows real-time data exchange between WPF applications and Unreal Engine programs, which is very important for interactive applications that require fast response. Socket communication usually has low latency, which is very useful for application scenarios that require high-precision time synchronization. Socket communication can support asynchronous data transmission and will not block the user interface thread of the WPF application, thereby improving the responsiveness of the application. Socket is a cross-platform communication method that can implement communication between WPF applications and UnrealEngine programs on different operating systems and hardware platforms. Socket communication does not limit the data format and can transmit text, binary data, or other custom format data, providing a high degree of flexibility. Through Socket, WPF applications can more finely control the behavior of UnrealEngine programs, such as sending control commands or status updates. Socket provides a relatively simple way to integrate different applications, reducing dependence on specific APIs or middleware. As application requirements grow, Socket communication can be easily expanded to support more data transmission and more complex communication modes. By using encrypted Socket connections, communication between WPF applications and Unreal Engine programs can be protected from unauthorized access. Socket communication can be designed to be fault-tolerant and able to handle network problems such as network delays, disconnections, and reconnections. Socket communication can use multithreading or multiprocessing to improve data processing capabilities, especially when processing large amounts of data or high-frequency communications. Compared to other communication methods, Socket communication can more effectively utilize system resources and reduce unnecessary overhead. Socket communication can support complex application scenarios, such as multiplayer online games, real-time collaboration tools, or distributed systems.

[0020] In a second aspect of the present application, a system for developing nested applications is provided, including an integration module, a nested module, a loading module, and an execution module, wherein: An integration module configured to integrate a WebView2 control, set the background of the WebView2 control to be transparent, and create a window with no border and a transparent background; A nesting module configured to use the HwndHost class to nest the WebView2 control and the rendering window of the UnrealEngine program; A loading module configured to load the content of a preset web page through the WebView2 control and display the content in the window; The execution module is configured to send the instruction to the Unreal Engine program when receiving the instruction input from the preset webpage, and display the rendering result of the Unreal Engine program executing the instruction through the rendering window.

[0021] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes any one of the methods described above.

[0022] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed, any of the methods described above is executed.

[0023] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. By integrating the WebView2 control and the Unreal Engine program, users can experience rich web content and high-quality 3D rendering effects in a seamlessly integrated environment. By integrating different technical components, multiple tasks such as web browsing and 3D rendering can be handled simultaneously in WPF applications. By providing an integrated approach, the development difficulty of combining different technology stacks (such as WPF, WebView2, and Unreal Engine) can be reduced; 2. The borderless and transparent background window design provides a more modern and immersive interface experience, making the application's UI elements and web content more harmoniously integrated. The transparent background and borderless window allow developers to freely design and layout the application's UI, including placing the WebView2 control and Unreal Engine rendering window anywhere; 3. Receiving user instructions through the WebView2 control and passing them to the Unreal Engine program can achieve fast interactive feedback and improve the responsiveness of user operations. Using the HwndHost class to manage the WebView2 control and the UnrealEngine rendering window helps optimize resource usage, reduce memory usage, and improve application performance; 4. By controlling the integration of WebView2 controls and Unreal Engine programs, the security of applications can be improved to a certain extent and potential malicious code execution can be prevented. WebView2 controls can dynamically load and update web content, while Unreal Engine programs can render 3D scenes or animations in real time based on these contents. Applications that combine web content and 3D rendering can open up new application scenarios, such as education, games, simulations, and visualizations. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 It is a flowchart of a method for developing a nested application program disclosed in an embodiment of the present application; Figure 2 It is a schematic diagram of the final interface of the WPF application disclosed in the embodiment of the present application; Figure 3 It is a module diagram of a system for developing nested applications disclosed in an embodiment of the present application; Figure 4 It is a structural schematic diagram of an electronic device disclosed in an embodiment of the present application.

[0025] Explanation of the reference numerals: 301, integration module; 302, nested module; 303, loading module; 304, execution module; 401, processor; 402, communication bus; 403, user interface; 404, network interface; 405, memory. DETAILED DESCRIPTION

[0026] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.

[0027] In the description of the embodiments of the present application, words such as "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "for example" or "for example" is intended to present related concepts in a specific way.

[0028] In the description of the embodiments of the present application, the meaning of the term "multiple" refers to two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0029] This embodiment discloses a method for developing a nested application program, which is applied to a WPF application program. Figure 1 is a flow chart of the method for developing nested application programs disclosed in the embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps: S110, integrating a WebView2 control, setting the background of the WebView2 control to be transparent, and creating a window with no border and a transparent background; The WebView2 control is a browser control provided by Microsoft that provides the same browsing experience and performance as mainstream browsers. Integrating the WebView2 control in a WPF application and making the WebView2 background transparent by modifying the underlying code allows developers to create web browsing functions with transparent backgrounds, providing more possibilities for application interface design.

[0030] Optionally, the integrated WebView2 control includes: Use the NuGet package manager to install the WebView2 control into the WPF application, and add a declaration of the WebView2 control in the WPF application to reference the WebView2 control; Initialize the WebView2 control, and set the source property of the WebView2 control to the uniform resource locator of the preset web page.

[0031] Open the Visual Studio development environment where the WPF project is located. Select the appropriate WebView2 version and add the WebView2 control to the project. Open the XAML page where you need to add the WebView2 control. Add the XML namespace declaration for the WebView2 control at the top of the XAML page. Add the WebView2 control in XAML. In the code behind the XAML page, create an instance of the WebView2 control and initialize it. Set the Source property of the WebView2 control to the URL (Uniform Resource Locator) of the preset web page, and add event handlers to respond to various events of the WebView2 control as needed. Run the application and check whether the WebView2 control works as expected, whether the web page is loaded correctly, and whether there are any performance or compatibility issues.

[0032] By integrating the WebView2 control, WPF applications can display web content inline, allowing users to access and interact with web pages without leaving the application. This seamless integration can greatly enhance the user experience and make applications more flexible and rich. The WebView2 control is based on the Chromium engine, so it has good cross-platform compatibility. This means that WPF applications can run on different Windows versions and display the same web content without worrying about browser compatibility issues. The WebView2 control provides the same security features as the latest Chromium browser, such as sandboxing, content isolation, and automatic updates. These features protect applications from malicious web pages and reduce potential security risks. The WebView2 control allows programmatic control of loading, navigating, and interacting with web content. You can use C# code to listen to web page events, inject JavaScript code, or call Web APIs, etc., to achieve more complex and flexible functions. Because the WebView2 control is based on the Chromium engine and can be updated through the NuGet package manager, you can easily get the latest browser features and security fixes. This means that WPF applications can always keep up with the times and benefit from the latest Web technologies. By integrating the WebView2 control, you can separate complex web development tasks (such as HTML, CSS, and JavaScript) from the development tasks of WPF applications. This means that you can use existing web development resources and skills to quickly build and deploy web page content in WPF applications. By loading web page content as external resources into the WebView2 control, it is easier to manage and update this content. You can use a version control system to track and share changes to web page resources, and easily roll back to a previous version when needed.

[0033] Optionally, setting the background of the WebView2 control to be transparent includes: The rendering content of the web page is captured using the application program interface of the WebView2 control, and the rendering content is displayed as a transparent image or layer in the WPF application.

[0034] Try to achieve a transparent background by adjusting the style of the WebView2 control. This usually involves setting the Background property of the control to transparent, or ensuring that no background color is overlaid on top of the WebView2 control. In terms of web content, you need to ensure that the web page itself also supports transparent backgrounds. This means that the CSS style of the web page should allow the background to be transparent, and there are no other elements or styles that block the transparent effect. If the WebView2 control itself does not support a transparent background, consider embedding the WebView2 control in a host window that supports a transparent background. This usually involves using the Windows API (application programming interface) to create a window with transparent properties and embedding the WebView2 control in this window. If the WebView2 control does not meet your needs, consider using other techniques to simulate the effect of a transparent background. For example, you can use the WPF HostVisual or DrawingVisual class to draw a custom transparent background and place the WebView2 control on top of this background. Alternatively, you can use the WPF OpacityMask property to create a transparent mask layer and apply it to the WebView2 control.

[0035] Displaying captured web page rendering content as a transparent image or layer in a WPF application enables more customized and flexible interface integration. This allows developers to seamlessly combine web content with native WPF controls to create a unique user experience. Displaying web page content with a transparent background can produce interesting visual overlay effects with other UI elements of a WPF application. This not only enhances the appearance of the application, but also makes the user interface more attractive. Even if the web page content is captured and displayed as a transparent image or layer, it can still maintain its original interactivity. Users can interact with the web page content just like in a browser, such as clicking buttons, filling out forms, etc. By displaying web page content as an image or layer, it can be easily combined with other WPF features, such as animation, transition effects, etc. This provides developers with more creative space to achieve a richer and more dynamic user interface.

[0036] Optionally, creating a window without borders and with a transparent background includes: Set the WindowStyle property to None to remove the standard border and set the Background property to Transparent to make the background transparent.

[0037] The WindowStyle property determines the style of the window border. Setting it to None removes the standard borders of the window, including the title bar, borders, and window control buttons (such as close, minimize, and maximize buttons). This allows developers to create a custom window appearance to suit specific design needs. The Background property defines the background color or image of the window. Setting it to Transparent (or a transparent color value) will make the window background transparent, allowing the underlying content (such as the desktop or other open windows) to be visible. However, it should be noted that in the Windows operating system, some parts of the window (such as the non-client area, that is, the title bar and border area) may still display the default window color even if the Background property is set to transparent. Combining borderless and transparent background windows with transparent background WebView2 controls can create a modern and highly integrated application interface. The WebView2 control allows Chromium-based web content to be embedded in WPF applications, and the transparent background makes the web content seamlessly integrated with the rest of the application, improving the user experience and the beauty of the interface.

[0038] With the removal of standard borders and transparent backgrounds, developers have greater freedom to design the appearance and layout of windows. This allows the creation of interfaces that are very different from standard Windows windows, thereby enhancing the uniqueness and appeal of applications. Borderless and transparent background window designs can make applications look more modern, simple, and integrated. Users will no longer be constrained by traditional window borders, providing a more smooth and natural interactive experience. When combined with the transparent background WebView2 control, this window design can achieve seamless integration of web content with native WPF controls. The WebView2 control can load and display web content, while the transparent background allows this content to blend with the rest of the application, further enhancing the user experience and the beauty of the interface. The transparent background can create a visual overlay effect on the window with the desktop or other underlying windows, creating an impressive visual effect. This overlay effect can increase the visual appeal of the application and make it stand out from the crowd. Since the standard borders have been removed, developers can more easily create custom controls and animation effects. They can add custom title bars, buttons, toolbars and other elements inside the window, and use animation effects to enhance the interactivity and appeal of the user interface. Although this window design is mainly for WPF applications on the Windows platform, it can also provide a similar look and feel for cross-platform applications. Through proper adaptation and adjustment, developers can achieve similar borderless and transparent background effects on different platforms, thereby maintaining the consistency and recognizability of the application.

[0039] S120, using the HwndHost class to nest and manage the WebView2 control and the rendering window of the Unreal Engine program; Through the HwndHost class in the WPF program, developers can nest and manage browser background transparent programs and Unreal Engine programs. This technical feature allows UI elements from different sources (such as WebView2 and UnrealEngine rendering windows) to be integrated in the same WPF application to build complex interfaces. The HwndHost class is used in WPF applications to host an external Win32 window (HWND, i.e. window handle) in a WPF control. This is very useful for integrating non-WPF UI elements (such as WinForms controls or other technologies that require HWND) into WPF applications. UnrealEngine is a powerful cross-platform game engine that is often used to develop high-quality games and real-time rendering applications. Unreal Engine provides a variety of options for integration with external systems, including integration with GUI frameworks (such as WPF). HwndHost can be used to host an intermediate application or control that communicates with Unreal Engine and captures its rendering output. This intermediate layer can pass the rendering content of Unreal Engine to the WPF application.

[0040] Optionally, the nested management of the WebView2 control and the rendering window of the Unreal Engine program using the HwndHost class includes: Create a derived class inherited from HwndHost, and associate the first window handle of the WebView2 control with the second window handle of the HwndHost according to the derived class; Obtaining a rendering window handle from the Unreal Engine program, and setting the rendering window handle through the derived class; Pass messages or use inter-process communication between the WPF application and the Unreal Engine program to maintain synchronization.

[0041] You need to create a class that inherits from System.Windows.Interop.HwndHost. This derived class will be responsible for hosting and managing external Win32 windows. In this derived class, you need to override two key methods: BuildWindowCore and DestroyWindowCore. The BuildWindowCore method is used to create a Win32 window and get its handle, while the DestroyWindowCore method is used to destroy the window. When the HwndHost derived class creates a Win32 window, you need to associate the window handle (HWND, the first window handle) of the WebView2 control with this Win32 window handle (the second window handle). This usually involves setting the window of the WebView2 control as a child window of the Win32 window created by the HwndHost derived class. Once you have the Unreal Engine rendering window handle, you can set it as a child window of the Win32 window created by the HwndHost derived class in a similar way. You may need to use other techniques (such as screen capture or shared textures) to display the Unreal Engine rendering content in your WPF application. Since the WPF application and the UnrealEngine program may run in different processes or threads, a communication mechanism needs to be established between them to maintain synchronization and pass messages. For simple needs, Windows messaging (such as sending and receiving window messages) can be used to pass information between the two programs. However, for more complex needs, more advanced inter-process communication (IPC) technologies such as named pipes, memory-mapped files, or sockets may be required.

[0042] Through the HwndHost derived class, WPF applications can flexibly integrate non-WPF native UI elements, such as the WebView2 control and the UnrealEngine rendering window. This integration allows developers to combine multiple UI technologies in the same WPF window to create feature-rich and beautiful applications. Compared with the use of screen capture or image transmission, direct window handle association and IPC can reduce unnecessary performance overhead, such as image rendering and transmission overhead. For the Unreal Engine rendering window, this integration method can directly display its rendering content, avoiding additional rendering steps and performance loss. Because the WebView2 control and the Unreal Engine rendering window are directly integrated into the WPF application, they can interact with other WPF controls. This enhanced interactivity can improve the user experience and enable users to seamlessly switch and interact with different UI elements on the same interface. By implementing message passing or IPC between the WPF application and the UnrealEngine program, real-time synchronization and data exchange between the two can be achieved. This synchronization and communication capability enables WPF applications to control the rendering parameters of the Unreal Engine, receive its status updates, etc., thereby achieving more complex interactive logic and effects. The HwndHost-based integration method is extensible and can easily integrate other non-WPF native UI elements or technologies. As technology develops and new technologies emerge, developers can easily integrate them into existing WPF applications to keep the applications updated and competitive. Although WPF itself is targeted at the Windows platform, the HwndHost integration method can provide a foundation for possible cross-platform expansion in the future. If WPF or related technologies support other operating systems in the future, the HwndHost integration method can make it easier to implement cross-platform applications.

[0043] Optionally, the method further includes: Define a first function that can be called by a front-end program in a WPF application, and use the WebView2 control to inject JavaScript code into the preset web page so that the preset web page calls the first function through the JavaScript code; A second function that needs to be called by the WPF application is defined in the preset web page, and a preset object is set in the WebView2 control so that the WPF application calls the second function through the preset object.

[0044] In WPF applications, the WebView2 control supports two-way communication between JavaScript and C#, which can easily realize the interaction between front-end JavaScript code and back-end C# code. In WPF applications, define a C# function (i.e., the first function), which will serve as an interface that can be called by the front-end JavaScript code. When the WebView2 control is loaded, a piece of JavaScript code needs to be injected, which will allow JavaScript to call the C# function. This is usually implemented through the ExecuteScriptAsync method of WebView2. In the front-end preset web page, define JavaScript functions (second functions), which will serve as interfaces that can be called by WPF applications. In WPF applications, you can call JavaScript functions defined in the web page through the WebView2 API. This is usually implemented through the ExecuteScriptAsync method, but you can also call exposed functions by injecting preset objects or using the EvaluateScriptAsync method.

[0045] Through the two-way communication mechanism, real-time data exchange and event processing can be achieved between WPF applications and front-end JavaScript programs, greatly enhancing the interactivity of the application. Users can perform operations in the front-end web page and call C# functions in the WPF application through JavaScript code to implement complex business logic processing. At the same time, the WPF application can also call the front-end JavaScript function through the preset object to dynamically update or control the front-end interface. The logic of the front-end and back-end is implemented separately through JavaScript and C#, and communicated through the WebView2 control, realizing the decoupling of the front-end and back-end. This decoupling design allows the front-end and back-end to be developed, tested and maintained independently, improving development efficiency. At the same time, the modular design also makes the code clearer, easier to understand and expand. The front-end and back-end communication is achieved by injecting JavaScript code and setting preset objects, allowing developers to flexibly define communication protocols and interfaces. As business needs change, the communication interface can be easily expanded or the communication logic can be modified to meet new needs. This flexibility also enables the application to easily integrate other front-end technologies or back-end services. Through the two-way communication between the front-end and back-end, a smoother and more natural user interaction experience can be achieved. For applications that need to process complex business logic and large amounts of data, more efficient data processing and more complex business logic implementation can be achieved through two-way communication between the front-end and back-end. Both front-end data display and interaction and back-end data processing and storage can be well supported by this communication mechanism.

[0046] Optionally, the method further includes: A Socket client is created in the WPF application and connected to the Socket server provided by the Unreal Engine program to achieve communication between the WPF application and the Unreal Engine program.

[0047] In the Unreal Engine program, you need to use C++ or the network API provided by Unreal Engine to set up a Socket server. This server needs to listen to a specific IP address and port so that the WPF application can connect to it. In the WPF application, you need to use the System.Net.Sockets namespace of C# to create a Socket client. Specifically, in the C# code of the WPF project, introduce the necessary namespaces. In a certain event of WPF (such as a button click event), you can create a Socket client and try to connect to the Socket server in the Unreal Engine program. In the WPF application, you can call this method through a button click or other user interaction event, and pass in the IP address and port number of the UnrealEngine Socket server. When the WPF application establishes a Socket connection with the Unreal Engine program, you can send commands or data through the Socket to control the rendering content of the Unreal Engine. This usually involves defining user interface elements (such as buttons, sliders, etc.) in WPF and sending corresponding Socket messages to Unreal Engine when the user interacts with these elements. In the Unreal Engine program, you need to write code to listen to the Socket connection and perform corresponding operations when receiving messages from WPF, such as changing rendering parameters, triggering animations, etc.

[0048] Through Socket communication, WPF applications can send instructions and data to Unreal Engine programs in real time and receive responses from Unreal Engine. This real-time nature ensures fast feedback between the user interface and the game engine or simulation engine, thereby improving the user experience. The Socket communication protocol is cross-platform, which means that WPF applications (running on Windows) can communicate with Unreal Engine programs running on other operating systems (such as Linux or macOS). This provides a flexible solution for cross-platform projects. Using Socket communication allows developers to define custom communication protocols and data formats. This increases the scalability of the system because new instructions or data types can be easily added based on project requirements. In addition, the flexibility of Socket communication allows developers to implement complex interaction logic, such as bidirectional data flow and synchronous / asynchronous communication. Compared with other communication methods (such as HTTP requests or file I / O), Socket communication generally has lower latency. This is because Socket communication establishes a connection directly between applications without forwarding through an intermediate layer (such as a web server). This is an important advantage for applications that require high-performance real-time interaction. By connecting WPF applications with Unreal Engine programs through Socket communication, developers can separate user interface logic from game / simulation logic. This separation allows the two systems to be developed, tested, and maintained independently, improving development efficiency. Socket communication provides an effective solution for applications that require complex user interfaces and game / simulation logic. Through real-time, two-way data transmission and command exchange, WPF applications can achieve precise control of UnrealEngine programs, thereby creating a richer user experience.

[0049] S130, loading the content of a preset web page through the WebView2 control, and displaying the content in the window; In the above steps, the WebView2 control has been set to point to the preset web address. When the WebView2 control loads the URL corresponding to the web address, it requests the web content on the server and renders the content inside the control. When the WebView2 control successfully loads and renders the content of the preset web page, the content will be directly displayed in the window of the WPF application. Users can see the same web page layout, style, and interactive effects in the window of the WPF application as in a regular browser. The WebView2 control not only allows loading and displaying web page content, but also supports interaction with web page content. Users can perform common web operations in the window of the WPF application, such as clicking buttons, filling out forms, scrolling pages, etc. At the same time, the WPF application can also interact with the JavaScript code in the web page through the API of the WebView2 control to achieve more complex functions. The WebView2 control provides a variety of security features to ensure security when loading and displaying web page content in WPF applications. For example, it can restrict web pages from accessing local resources, executing malicious code, or conducting unauthorized communications. In addition, the WebView2 control also supports integration with the security sandbox mechanism of the WPF application, further enhancing the security of the application.

[0050] S140: When receiving the instruction input from the preset webpage, sending the instruction to the UnrealEngine program, and displaying the rendering result of the Unreal Engine program executing the instruction through the rendering window.

[0051] The preset web page needs to contain some user interface elements (such as buttons, input boxes, etc.) that allow users to enter instructions. When the user interacts with these elements (such as clicking a button or submitting a form), the JavaScript code in the web page captures these events and processes the user's input. When the JavaScript code captures the user's input instructions, it needs to communicate with the WPF application in some way to send the instructions to the Unreal Engine program. This can usually be achieved through the API provided by the WebView2 control. The WebView2 control allows WPF applications to register event handlers to listen for messages from web pages. JavaScript code can use the window.chrome.webview.postMessage method to send messages (that is, user input instructions) to the WPF application. The event handler in the WPF application receives these messages and can process them. When the WPF application receives messages from the web page (that is, user input instructions), it needs to send these instructions to the Unreal Engine program. This can be achieved through the Socket connection established previously. The WPF application can serialize the user's input instructions into byte data and send them to the Unreal Engine program through the Socket connection. The Socket server in the Unreal Engine program receives this data and decodes it into the corresponding instructions. When the Unreal Engine program receives instructions from the WPF application, it parses these instructions and performs corresponding operations. These operations may include changing objects in the scene, triggering animations, updating physical simulations, etc. The Unreal Engine program updates its rendering results according to the instructions and may generate new frames to display these changes. These rendering results can be shared with the WPF application in some way (such as shared memory, files, network transmission, etc.). The WPF application needs to display the rendering results of the Unreal Engine program in its rendering window.

[0052] The following is a detailed explanation using an example: Suppose you are developing an interactive virtual reality (VR) display application. The application needs to integrate an online VR tour interface and use it to control the 3D scene rendered by Unreal Engine in real time. Users can access the VR tour interface through a web browser, view a preview of the 3D scene, and operate objects in the scene through buttons or gestures on the interface. At the same time, the application also needs to provide a custom interface to display user information and control options.

[0053] Figure 2This is the final interface diagram of the WPF application disclosed in the embodiment of this application, combined with Figure 2 Provide explanation.

[0054] Integrate the WebView2 control in the WPF application and achieve the background transparency effect. The WebView2 control will be used to load and display the preset web page content, including the interface elements related to the virtual human live broadcast. Customize the style of the WPF window, remove the window border and set a transparent background to provide an immersive user experience. At the same time, consider reserving a suitable position and size in the window for the virtual human live broadcast. Use the HwndHost class to nest the rendering window of the Unreal Engine program to display high-quality 3D rendering content in the WPF application. This part of the content may include virtual human models, scenes, and other 3D elements related to live broadcasts.

[0055] Use the API of the WebView2 control for two-way communication between JavaScript and C#. In this way, the front-end program can call the C# function in the WPF application to send instructions to the Unreal Engine program, such as controlling the movements and expressions of the virtual human. At the same time, the WPF application can also call the JavaScript function in the front-end page, such as obtaining the live broadcast status, user interaction, etc. Integrate the virtual human live broadcast system in the web page loaded by the WebView2 control. This can include loading and rendering the virtual human model, capturing the camera and microphone devices, transmitting and processing real-time audio and video streams, etc. Ensure that the virtual human model is displayed in high-quality 3D in the Unreal Engine rendering window and synchronized with the live audio and video streams. Create a Socket client in the WPF application and connect to the Socket server provided by the Unreal Engine program. Through the Socket connection, the WPF application can send instructions to the Unreal Engine program, such as controlling the movements and expressions of the virtual human, and receive the response returned by it. At the same time, the Socket connection can also be used to transmit live audio and video streams to ensure a smooth live broadcast experience.

[0056] Integrate the WebView2 control, Unreal Engine rendering window, virtual human live broadcast system, and customized WPF interface to form a complete interactive VR live broadcast display application. During the development process, continuous testing and debugging are carried out to ensure that the various components work together normally and can meet user needs. Optimize the virtual human live broadcast function according to specific needs. For example, increase the virtual human's expression and action library, improve the rendering quality and frame rate, optimize the transmission and processing of audio and video streams, etc. At the same time, consider adding user interaction functions such as barrage, likes, comments, etc. to enhance the participation and interactivity of the live broadcast.

[0057] The transparent background WebView2 control development front-end interactive interface in the embodiment of the present application makes the application interface more beautiful and modern, and enhances the user's visual experience. The real-time rendered Unreal Engine content is embedded in the WPF application, so that users can directly view and operate high-quality 3D rendering effects in the application, further improving the user experience. The nested management function of the HwndHost class enables UI elements from different sources to work efficiently together in a unified WPF application, improving the operating efficiency and development efficiency of the entire application. The embodiment of the present application provides a complete set of nested application development solutions, and developers do not need to write the underlying code from scratch, which greatly saves development time and labor costs. The unified development environment and tool chain enable developers to complete development work from the front end to the back end on one platform, reducing the complexity of switching and integration between different platforms. The transparent WebView2 control development front-end interactive interface and the customized WPF window design enable developers to quickly build an interface with a unique style and function, reducing the workload of designing and developing the UnrealEngine interface and the difficulty of getting started with development. The integrated design of the application allows users to complete multiple tasks in a unified interface without frequently switching applications or opening multiple windows. The intuitive and easy-to-use interface design and user-friendly operation process enable users to quickly get started and use the application efficiently. The real-time rendering of Unreal Engine's high-precision characters and scene content provides intuitive visual feedback, allowing users to intuitively understand the operation results and status, reducing the learning cost and difficulty of use.

[0058] This embodiment also discloses a system for developing nested application programs. Figure 3 Schematic diagram of the modules of the system for developing nested application programs disclosed in the embodiment of the present application. Figure 3 As shown, the system includes an integration module 301, a nesting module 302, a loading module 303 and an execution module 304, wherein: The integration module 301 is configured to integrate a WebView2 control, set the background of the WebView2 control to be transparent, and create a window with no border and a transparent background; The nesting module 302 is configured to use the HwndHost class to nest the WebView2 control and the rendering window of the UnrealEngine program; A loading module 303 is configured to load the content of a preset web page through the WebView2 control and display the content in the window; The execution module 304 is configured to send the instruction to the Unreal Engine program when receiving the instruction input from the preset webpage, and display the rendering result of the Unreal Engine program executing the instruction through the rendering window.

[0059] Optionally, the integration module 301 is configured to: Use the NuGet package manager to install the WebView2 control into the WPF application, and add a declaration of the WebView2 control in the WPF application to reference the WebView2 control; Initialize the WebView2 control, and set the source property of the WebView2 control to the uniform resource locator of the preset web page.

[0060] Optionally, the integration module 301 is configured to: The rendering content of the web page is captured using the application program interface of the WebView2 control, and the rendering content is displayed as a transparent image or layer in the WPF application.

[0061] Optionally, the integration module 301 is configured to: Set the WindowStyle property to None to remove the standard border and set the Background property to Transparent to make the background transparent.

[0062] Optionally, the nesting module 302 is configured to: Create a derived class inherited from HwndHost, and associate the first window handle of the WebView2 control with the second window handle of the HwndHost according to the derived class; Obtaining a rendering window handle from the Unreal Engine program, and setting the rendering window handle through the derived class; Pass messages or use inter-process communication between the WPF application and the Unreal Engine program to maintain synchronization.

[0063] Optionally, the system further includes a first interaction module, wherein the first interaction module is configured to: Define a first function that can be called by a front-end program in a WPF application, and use the WebView2 control to inject JavaScript code into the preset web page so that the preset web page calls the first function through the JavaScript code; A second function that needs to be called by the WPF application is defined in the preset web page, and a preset object is set in the WebView2 control so that the WPF application calls the second function through the preset object.

[0064] Optionally, the system further includes a second interaction module, wherein the second interaction module is configured to: A Socket client is created in the WPF application and connected to the Socket server provided by the Unreal Engine program to achieve communication between the WPF application and the Unreal Engine program.

[0065] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0066] This embodiment also discloses an electronic device, referring to Figure 4 The electronic device may include: at least one processor 401 , at least one communication bus 402 , a user interface 403 , a network interface 404 , and at least one memory 405 .

[0067] The communication bus 402 is used to realize the connection and communication between these components.

[0068] The user interface 403 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 403 may also include a standard wired interface and a wireless interface.

[0069] The network interface 404 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0070] Among them, the processor 401 may include one or more processing cores. The processor 401 uses various interfaces and lines to connect various parts in the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 405, and calling data stored in the memory 405. Optionally, the processor 401 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 401 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 401, and it can be implemented separately through a chip.

[0071] Among them, the memory 405 may include a random access memory (RAM) or a read-only memory (Read-Only Memory). Optionally, the memory 405 includes a non-transitory computer-readable storage medium. The memory 405 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 405 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 405 may also be at least one storage device located away from the aforementioned processor 401. As shown in the figure, the memory 405 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application program of a method for developing nested application programs.

[0072] exist Figure 4In the electronic device shown, the user interface 403 is mainly used to provide an input interface for the user and obtain data input by the user; and the processor 401 can be used to call the application program of the method for developing nested applications stored in the memory 405. When executed by one or more processors 401, the electronic device executes one or more methods in the above-mentioned embodiments.

[0073] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application.

[0074] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0075] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0076] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0077] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0078] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory 405, including a number of instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned memory 405 includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk.

[0079] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification, those skilled in the art will easily think of other embodiments of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field that are not recorded in the present disclosure. The description and examples are only regarded as exemplary, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. A method for developing nested applications, characterized in that: Applied to a WPF application, the method includes: Integrate the WebView2 control, set the background of the WebView2 control to be transparent, and create a window with no border and transparent background; Use the HwndHost class to nest and manage the WebView2 control and the rendering window of the Unreal Engine program; Loading the content of a preset web page through the WebView2 control and displaying the content in the window; When receiving the instruction inputted from the preset webpage, the instruction is sent to the Unreal Engine program, and the rendering result of the Unreal Engine program executing the instruction is displayed through the rendering window.

2. The method for developing nested applications according to claim 1, characterized in that: The integrated WebView2 control includes: Use the NuGet package manager to install the WebView2 control into the WPF application, and add a declaration of the WebView2 control in the WPF application to reference the WebView2 control; Initialize the WebView2 control, and set the source property of the WebView2 control to the uniform resource locator of the preset web page.

3. The method for developing nested applications according to claim 1, characterized in that: Setting the background of the WebView2 control to be transparent includes: The rendering content of the web page is captured using the application program interface of the WebView2 control, and the rendering content is displayed as a transparent image or layer in the WPF application.

4. The method for developing nested applications according to claim 1, characterized in that: The creation of a borderless and transparent background window includes: Set the WindowStyle property to None to remove the standard border and set the Background property to Transparent to make the background transparent.

5. The method for developing nested applications according to claim 1, characterized in that: The method of using the HwndHost class to nest the WebView2 control and the rendering window of the Unreal Engine program includes: Create a derived class inherited from HwndHost, and associate the first window handle of the WebView2 control with the second window handle of the HwndHost according to the derived class; Obtaining a rendering window handle from the Unreal Engine program, and setting the rendering window handle through the derived class; Pass messages or use inter-process communication between the WPF application and the Unreal Engine program to maintain synchronization.

6. The method for developing nested applications according to claim 1, characterized in that: The method further comprises: Define a first function that can be called by a front-end program in a WPF application, and use the WebView2 control to inject JavaScript code into the preset web page so that the preset web page calls the first function through the JavaScript code; A second function that needs to be called by the WPF application is defined in the preset web page, and a preset object is set in the WebView2 control so that the WPF application calls the second function through the preset object.

7. The method for developing nested applications according to claim 1, characterized in that: The method further comprises: A Socket client is created in the WPF application and connected to the Socket server provided by the Unreal Engine program to achieve communication between the WPF application and the Unreal Engine program.

8. A system for developing nested applications, characterized in that: It includes integration modules, nested modules, loading modules and execution modules, among which: An integration module configured to integrate a WebView2 control, set the background of the WebView2 control to be transparent, and create a window with no border and a transparent background; A nesting module configured to use the HwndHost class to nest the WebView2 control and the rendering window of the Unreal Engine program; A loading module configured to load the content of a preset web page through the WebView2 control and display the content in the window; The execution module is configured to send the instruction to the Unreal Engine program when receiving the instruction input from the preset webpage, and display the rendering result of the Unreal Engine program executing the instruction through the rendering window.

9. An electronic device, characterized in that: It includes a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is executed.