Method for converting 64-bit desktop application (WinForm / WPF / MFC / Win32) into browser host process
By initializing the browser mechanism in the desktop application's entry function, the problem of existing technologies being unable to convert desktop applications into browser main processes is solved, enabling browser function integration without reconstruction and providing complete browser function support.
Patent Information
- Application Number
- CN202511021131.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-24
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2045-07-24
AI Technical Summary
Existing technologies cannot transform desktop applications into browser main processes with full browser functionality, and require complex reconstruction or reliance on external browser processes, making it impossible to implement features such as multi-tabs and NTP.
The InitBrowser function is called in the desktop application's entry function to initialize the browser mechanism before the first window is created. This integrates the browser's multi-tab management, navigation control, and developer tool scheduling modules, transforming the desktop application's main process into the browser's main process.
Without modifying the application design architecture, it achieves browser-level multi-tab management, NTP mechanism and browser extension support, breaking the limitations of traditional browser control initialization and forming a browser multi-process architecture.
Smart Images

Figure CN120909679A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of desktop application development, and more particularly, to a method for converting a 64-bit desktop application (WinForm / WPF / MFC / Win32) into a browser main process. BACKGROUND
[0002] Taking the desktop Internet as a whole drivable resource is the core positioning of modern Web browsers, but it has never been the basic positioning of desktop applications. This is not because there is no demand, but it is the inevitable result of technical limitations. Therefore, various compromise solutions have emerged:
[0003] Developers either completely reconstruct desktop applications based on Web technology, which is similar to the Electron technology architecture;
[0004] Or developers insert a special control in a specific window to display a specific page, such as CEF, WebView2, or CEFSharp control technology.
[0005] No matter which compromise technology, it can only allow desktop applications to present limited desktop Internet resources. All known desktop application development technologies cannot make the "desktop Internet resources" as a whole become part of the desktop application drive. The specific limitations are:
[0006] The prior art achieves loading Web content by embedding a browser control, but cannot convert the native desktop application into a real browser main process, thereby failing to provide complete browser functions (such as multi-tab, NTP, TabStrip, etc.). In addition, these solutions often require developers to perform complex reconstruction or configure a large number of middleware, and usually rely on external browser processes or independent framework architectures, which cannot achieve complete integration of the application and the browser engine.
[0007] Therefore, there is an urgent need in the field of desktop applications for a technical solution that can drive desktop Internet resources as a whole without reconstructing the original application architecture. The more accurate goal is to convert the desktop application main process into a browser process with complete browser functions while maintaining the native application structure. SUMMARY
[0008] In order to overcome the above limitations of the prior art, the present application provides a method for converting a 64-bit desktop application (WinForm / WPF / MFC / Win32) into a browser main process to solve the problems raised in the background art.
[0009] To achieve the above purpose, the present application provides the following technical solutions:
[0010] The function InitBrowser outputted by universe.dll is called in the desktop application entry function to start the initialization of the browser mechanism, and the initialization must occur before the first window object is created, wherein the InitBrowser function initializes the current process as a browser process with the functions of a browser main process, including multi-tab management, navigation control, developer tool scheduling, and extension support framework.
[0011] Preferably, the process conversion includes browser multi-tab management module injection, address bar navigation control system activation, and developer tool scheduling module integration.
[0012] Preferably, when the InitBrowser function is executed, if the current process is the first instance, the process is converted into a browser process and the browser function initialization is completed.
[0013] If the current process is a subsequent instance, the process is terminated and a request for creating a new browser window is forwarded to the first instance.
[0014] Technical effects and advantages of the present application:
[0015] 1. Without modifying the application design architecture, only adding initialization code before the first window is created in the application entry function, no complex reconstruction of the application is required, and the integrity of the native application is maintained.
[0016] 2. Main process initialization of the browser mechanism: the key of the present application is that the desktop application main process is used as a browser process of a Web browser, forming a browser multi-process architecture.
[0017] 3. Complete browser process functions: 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] The browser control initialization of the prior art (such as CEF / WebView2) must rely on an existing window handle, so its operation must occur after CreateWindowEx. The present application fundamentally breaks this limitation by preemptively initializing before the first window is created, thereby realizing process-level conversion, which is the core prerequisite for realizing "zero architecture intrusion". BRIEF DESCRIPTION OF DRAWINGS
[0019] Figure 1 is a basic outline of the present application.
[0020] Figure 2 is an initialization flowchart of the present application. DETAILED DESCRIPTION
[0021] With reference to the drawings of the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments of the present application, all the other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.
[0022] The present application provides a method for converting 64-bit desktop applications (WinForm / WPF / MFC / Win32) into a browser main process, and the steps are as follows:
[0023] The desktop application entry function (such as WinMain, CWinApp: InitInstance, and Main function of various development language frameworks) must call the function InitBrowser output by the dynamic library "universe.dll" before the first window is created, so as to start the browser mechanism initialization work, and the specific initialization process is as follows:
[0024] 1. The dynamic library "universe.dll" is loaded by using the LoadLibrary function;
[0025] 2. The function pointer pInit of the function InitBrowser output by the dynamic library "universe.dll" is obtained by using the GetProcAddress:
[0026] pInit = (bool (*) ()) GetProcAddress (hDll, "InitBrowser");
[0027] 3. After obtaining the function pointer pInit, the following code is executed:
[0028] if (pInit && pInit ()) return 0;
[0029] When the InitBrowser() function is executed, the current process is initialized as a browsing process with the function of a browser main process, and the function includes multi-tab management, navigation control, developer tool scheduling, and extension support framework;
[0030] The process conversion includes: browser multi-tab management module injection, address bar navigation control system activation, and developer tool scheduling module integration;
[0031] When InitBrowser() is executed, if the current process is the first instance, it is converted into a browsing process and completes the browser function initialization;
[0032] If the current process is a subsequent instance, the process is terminated and the request to create a new window is forwarded to the first instance.
[0033] The present application proposes a technical architecture which takes the desktop application main process as the core and embeds the initialization of complete browser function structure. After the initialization of the desktop application, the desktop Internet can be used as a whole drivable resource. The scheme does not depend on the browser control, and under the premise of not reconstructing the original application architecture, the desktop application has modern browser functions such as multi-tab page, extension support, and developer tools. The present application belongs to the system-level architecture insertion mechanism, which is different from the traditional "control type Web embedding" technical path.
[0034] In comparison, the scheme such as CEF is essentially a window decoration technology, which realizes function expansion by adding a web page rendering control in the existing window; and the present application belongs to the process identity reconstruction technology, which converts the application process from "application" to "browser", which is a qualitative change in the subject identity at the operating system level
[0035] The browser browsing process function structure described in the present application takes the BrowserProcess defined by the Chromium Project as the reference standard, and includes:
[0036] a) a multi-tab page management module;
[0037] b) an independent address bar and navigation control module;
[0038] c) a developer tool scheduling module;
[0039] d) a browser extension support framework.
[0040] When the InitBrowser() function is executed, the runtime instance environment of the first desktop application process is reconstructed as the architecture of the browser process, including but not limited to:
[0041] initializing the global manager of the browser kernel (such as the tab page manager and the navigation controller);
[0042] establishing the inter-process communication (IPC) channel of the browser process;
[0043] loading the browser extension framework;
[0044] injecting the developer tool backend service.
[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 following process)
[0063] while (GetMessage(...)) {...}
[0064] }
[0065] Example 2: MFC application engineering, in the application initialization function:
[0066] BOOL CtestMFCAppApp::InitInstance() {
[0067] / / Copy the code in 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 following process)
[0071] CWinApp::InitInstance();
[0072] ...
[0073] }
[0074] Example 3: C# WinForm project
[0075] Add the static class BrowserInitializer in Table 2 in the C# project, and then add the following code before the Application.Run call:
[0076] if (BrowserInitializer.InitBrowserEx()) return; / / Browser takeover / / The following is the original application logic (no need to modify, the first application instance will execute the following process)
[0077] Application.Run(new Form1()).
[0078] It needs to be specifically pointed out that the Creator browser is a core component installation package provided by the patent invention team, which contains all the binary core libraries required by the patent technology. After installation, the key components are uniformly installed in the "Program Files\Tangram\AIGCBrowser" folder, and all applications related to the application share the same binary service package. "universe.dll" is a key dynamic link library provided in the Creator installation package,
[0079] The universe.dll in the application is a self-developed dynamic link library, which has no dependence on any modern browser-related engine, technology (such as CEF, WebView2, Chromium Project, etc.) in terms of source code. The developer only needs one function output in the dynamic library, and the function prototype is as follows:
[0080] __declspec(dllexport)bool__stdcall InitBrowser()
[0081] Finally: the above only for the preferred embodiment of the present application, and not for limiting the present application, any modification, equivalent replacement, improvement, etc. within the spirit and principles of the present application, should be included in the protection scope of the present application.
Claims
1. A method for converting 64-bit desktop applications (WinForm / WPF / MFC / Win32) into a browser main process, characterized in that, 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; If the current process is the first running instance, the current process is initialized as the browser main process, and the complete process of the desktop application is normally expanded, and an inter-process communication channel, a multi-tab page management framework and a plug-in extension running environment are established; If the current process is a new process instance started after the main process, the main process is notified to create a new browser window in the initialization link, and then the current process is ended to avoid the existence of multiple main process instances simultaneously.
Citation Information
Patent Citations
Web application transitioning and transient web applications
CN102947792A
Method and device for embedding applet in browser page
CN111176752A
Construction method and device of web desktop application and electronic equipment
CN116382829A
Method and apparatus for dynamically implementing application function
US20170185431A1