A method for converting 64-bit desktop applications (WinForm / WPF / MFC / Win32) into a browser main process
By initializing the browser mechanism in the desktop application's entry function, the problem of existing technologies being unable to transform desktop applications into browser main processes is solved. This enables native applications to have browser functionality, avoids complex refactoring and external dependencies, and forms a multi-process browser architecture.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING TANGRIMANG TECHNOLOGY CO LTD
- Filing Date
- 2025-07-24
- Publication Date
- 2026-04-10
AI Technical Summary
Existing technologies cannot transform desktop applications into browser master processes with full browser functionality, and require complex reconstruction or reliance on external browser processes, thus failing to achieve complete integration of applications and browser engines.
The InitBrowser function is called in the desktop application entry function to initialize the browser mechanism, including multi-tab management, navigation control and developer tool scheduling modules, and realize the process identity reconstruction to the browser main process, forming a browser multi-process architecture.
Without modifying the application design architecture, it transforms native applications into browser-level multi-tab management, NTP mechanism, and browser extension support, breaking the limitations of traditional browser control initialization and achieving zero architectural intrusion.
Smart Images

Figure CN120909679B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of desktop application development technology, and more specifically, to a method for converting a 64-bit desktop application (WinForm / WPF / MFC / Win32) into a browser main process. Background Technology
[0002] Treating the desktop internet as a holistic, driveable resource is the core positioning of modern web browsers, but it has never been the fundamental positioning of desktop applications. This is not due to a lack of demand, but rather an inevitable result of technological limitations. Therefore, various compromise solutions have emerged:
[0003] Alternatively, developers can completely reconstruct the desktop application based on web technologies—this is similar to the Electron technology architecture.
[0004] Alternatively, developers can insert a special type of control into a specific window to display a specific set of pages—control technologies such as CEF, WebView2, or CEFSharp.
[0005] Regardless of the type of compromise technology, each can only allow desktop applications to present limited desktop internet resources. None of these known technologies designed for desktop application development can make "desktop internet resources" as a whole a driving force for desktop applications. Specific limitations include:
[0006] Existing technologies load web content by embedding browser controls, but they cannot transform native desktop applications into a true browser main process, thus failing to provide complete browser functionality (such as multi-tabs, NTP, TabStrip, etc.). In addition, these solutions often require developers to perform complex refactoring or configure a large number of middleware, and usually rely on external browser processes or independent framework architectures, failing to achieve complete integration of the application and the browser engine.
[0007] Therefore, the desktop application field urgently needs a technical solution that can manage desktop internet resources without reconstructing the original application architecture. More precisely, the goal is to transform the desktop application's main process into a browsing process with full browser functionality while maintaining the native application structure. Summary of the Invention
[0008] In order to overcome the limitations of the prior art, the present invention provides a method for converting 64-bit desktop applications (WinForm / WPF / MFC / Win32) into browser main processes, so as to solve the problems mentioned in the background art.
[0009] To achieve the above objectives, the present invention provides the following technical solution:
[0010] The initialization of the browser mechanism is initiated by calling the function "InitBrowser" exported by "universe.dll" in the desktop application entry function. The initialization work must occur before the creation of the first window object. When the InitBrowser function is executed, the current process is initialized as a browsing process with the functions of the browser main process. These functions include multi-tab management, navigation control, developer tool scheduling, and extended support framework.
[0011] Preferably, the process transformation includes: injecting the browser multi-tab management module, activating the address bar navigation control system, and integrating the developer tool scheduling module.
[0012] Preferably, when InitBrowser is executed, if the current process is the first instance, it is converted into a browsing process and the browser functionality is initialized.
[0013] If the current process is a subsequent instance, then terminate the process and forward the request to create a new browser window to the first instance.
[0014] The technical effects and advantages of this invention are as follows:
[0015] 1. Without modifying the application's design architecture, simply add initialization code once before creating the first window in the application's entry function. This eliminates the need for complex refactoring of the application and maintains the integrity of the native application.
[0016] 2. Main process initialization browser mechanism: The key to this invention is that the desktop application main process is used as the browsing process of the web browser, forming a multi-process browser architecture;
[0017] 3. Complete browsing process functionality: By loading and initializing the browser engine, the application can directly obtain browser-level multi-tab management, NTP mechanism, browser extension support and other functions.
[0018] Existing technologies (such as CEF / WebView2) require browser control initialization to depend on an existing window handle, thus their operation must occur after CreateWindowEx. This invention fundamentally breaks this limitation by preemptively initializing the control before the first window is created, achieving process-level transformation, which is the core prerequisite for achieving "zero architectural intrusion." Attached Figure Description
[0019] Figure 1 This is a schematic diagram of the basic outline of the present invention.
[0020] Figure 2 This is a schematic diagram of the initialization process of the present invention. Detailed Implementation
[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0022] This invention provides a method for converting a 64-bit desktop application (WinForm / WPF / MFC / Win32) into a browser main process, the steps of which are as follows:
[0023] Desktop application entry functions (such as WinMain, CWinApp::InitInstance, and the Main function of various development language frameworks, etc.) must call the "InitBrowser function exported by universe.dll" before the first window is created to start the browser mechanism initialization work. The specific initialization process is as follows:
[0024] 1. Use the LoadLibrary function to load the dynamic library "universe.dll";
[0025] 2. Use GetProcAddress to obtain the function pointer pInit of the function "InitBrowser" exported by "universe.dll":
[0026] pInit=(bool(*)())GetProcAddress(hDll,"InitBrowser");
[0027] 3. After obtaining the function pointer pInit, execute the following code:
[0028] if (pInit && pInit()) return 0;
[0029] When the InitBrowser() function is executed, the current process is initialized as a browsing process with the functions of a browser main process, including multi-tab management, navigation control, developer tool scheduling, and extended support framework.
[0030] The process transformation includes: injecting the browser's multi-tab management module, activating the address bar navigation control system, and integrating the developer tools scheduling module;
[0031] When InitBrowser() is executed, if the current process is the first instance, it is converted into a browsing process and the browser functionality is initialized.
[0032] If the current process is a subsequent instance, terminate the process and forward the request to create a new window to the first instance.
[0033] This invention proposes a technical architecture that uses the desktop application's main process as its core, embedding a complete browser functional structure for initialization. This allows the initialized desktop application to treat the desktop internet as a unified, driverable resource. This solution does not rely on browser controls and, without reconstructing the original application architecture, provides modern browser functionalities such as multi-tab functionality, extension support, and developer tools. This invention belongs to a system-level architecture insertion mechanism, differing from the traditional "control-based web embedding" technical approach.
[0034] In contrast, solutions like CEF are essentially window decoration technologies, extending functionality by adding web page rendering controls to existing windows; while this invention belongs to process identity reconstruction technology, transforming the application process from an "application" to a "browser," representing a qualitative change in the subject's identity at the operating system level.
[0035] The browser browsing process functional structure described in this invention is based on the BrowserProcess defined by the Chromium Project, and includes:
[0036] a) Multi-tab management module;
[0037] b) Independent address bar and navigation control module;
[0038] c) Developer tools scheduling module;
[0039] d) Browser extension support framework.
[0040] When the InitBrowser() function is executed, it restructures the runtime instance environment of the first desktop application process into the architecture of a browser process, including but not limited to:
[0041] Initialize the global manager of the browser kernel (such as the tab manager and navigation controller);
[0042] Establish an inter-process communication (IPC) channel for the browser;
[0043] Load the browser extension framework;
[0044] Inject backend services into the developer tools.
[0045] After this initialization process is completed, all the code flow, message loops, etc. of the first process instance are completely preserved, and the process has been identified as the browser's main process at the operating system level.
[0046] After the browsing process completes its initialization, any newly launched application instance will detect that the browser initialization is complete, and then notify the first launched instance to create a new browser window, and then terminate the newly launched instance normally.
[0047] The complete structure of the initialization code of this invention is shown in Table 1:
[0048]
[0049] Table 1 shows the complete structure of the initialization code.
[0050] The code in Table 1 represents a standard process of loading a dynamic link library, obtaining a function pointer, calling the function pointer, and retrieving the return value. This process can be matched to all development technologies that support dynamic link libraries (such as WPF, Qt, etc.) through a standard "translation process," enabling desktop applications developed using these technologies to complete this initialization process. Taking C# as an example, the process in Table 1 can be encapsulated into a static C# class as shown in Table 2:
[0051]
[0052] Table 2 shows the C# static class encapsulation table for the initialization process.
[0053] Example
[0054] All the code added in all embodiments is concentrated in a relatively fixed part of the initialization location. In other words, the added code is characterized by being concentrated, not scattered, and easy to control.
[0055] Example 1: Direct Integration
[0056] int WINAPI WinMain(...){
[0057] / / ***************begin forces timing regions***************
[0058] / / [Copy the code from Table 1 before creating the window]
[0059] TCHAR m_szBuffer[MAX_PATH];
[0060] / / The rest of the copied code is omitted here...
[0061] / / ***************end Forced Timing Region***************
[0062] / / The following is the original application logic (no need to modify, the first application instance will execute the subsequent process)
[0063] while(GetMessage(...)){...}
[0064] }
[0065] Example 2: MFC application project, in the application initialization function:
[0066] BOOL CtestMFCAppApp::InitInstance(){
[0067] / / [Copy the code from Table 1 before CWinApp::InitInstance()]
[0068] TCHAR m_szBuffer[MAX_PATH];
[0069] / / The rest of the copied code is omitted here...
[0070] / / The following is the original application logic (no need to modify, the first application instance will execute the subsequent process)
[0071] CWinApp::InitInstance();
[0072] ………………………………
[0073] }
[0074] Example 3: C# WinForm Project
[0075] In your C# project, add the static class BrowserInitializer from Table 2, and then add the following code before calling Application.Run:
[0076] if(BrowserInitializer.InitBrowserEx())return; / / Browser takes over / / The following is the original application logic (no need to modify, the first application instance will execute the subsequent process)
[0077] Application.Run(new Form1()).
[0078] It should be noted that the Creator browser is the core component installation package provided by the patent invention team. It contains all the binary core libraries required for the patented technology. After installation, the key components are uniformly installed in the "Program Files\Tangram\AIGCBrowser" folder. All applications using this invention share the same binary service package. "universe.dll" is a key dynamic link library provided in the Creator installation package.
[0079] The universe.dll used in this invention is a self-developed dynamic link library. Its source code has absolutely no dependencies on any modern browser-related engines or technologies (such as CEF, WebView2, Chromium Project, etc.). Developers only need one function exported from this dynamic library, whose function prototype is:
[0080] __declspec(dllexport)bool__stdcall InitBrowser()
[0081] In conclusion, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method of converting a 64-bit desktop application into a browser main process, the method comprising: The method comprises the following steps: Before the host program creates any window object, an initialization function InitBrowser in a dynamic link library universe.dll is called to start the browser mechanism initialization, and the initialization process comprises: A dynamic library "universe.dll" is loaded by using a LoadLibrary function; A function pointer pInit of a function "InitBrowser" output by the "universe.dll" is obtained by using a GetProcAddress function: pInit = (bool(*)())GetProcAddress(hDll, "InitBrowser"); After the function pointer pInit is obtained, the following code is executed: if(pInit && pInit())return 0; When the InitBrowser() function is executed, the current process is initialized as a browsing process with a browser main process function, and the function comprises multi-tab management, navigation control, developer tool scheduling and extension support framework; The process conversion comprises browser multi-tab management module injection, address bar navigation control system activation and developer tool scheduling module integration; If the current process is the first running instance, the current process is initialized as a browser main process, and a complete process of the desktop application is normally expanded, and an inter-process communication channel, a multi-tab management framework and a plug-in extension running environment are established; If the current process is a new process instance after the main process is started, the main process is informed to create a new browser window in the initialization link, and then the current process is ended, so that multiple main process instances do not exist simultaneously.
Citation Information
Patent Citations
Construction method and device of web desktop application and electronic equipment
CN116382829A