Method and device for displaying file directory structure in compressed package
By creating a compressed file display window in File Explorer and using a decompression tool to show the file directory structure within the compressed file, the problem of File Explorer not being able to display the file directory within the compressed file was solved, thus improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 成都安易迅科技有限公司
- Filing Date
- 2025-12-16
- Publication Date
- 2026-05-19
AI Technical Summary
The existing file explorer interface cannot display the file directory structure within a compressed file, resulting in a degraded user experience.
A method for displaying the file directory structure within a compressed archive is provided. By obtaining the current display position of the preview window in the resource explorer, a compressed archive display window is created, and a decompression tool is used to read the preview object from the target compressed archive file. Based on the file directory structure, the file information within the archive is displayed in a tree structure in the compressed archive display window.
It enables a visual display of the files and directory structure within a compressed archive without decompressing it, thus improving the user experience.
Smart Images

Figure CN122064657A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method and apparatus for displaying the directory structure of files within a compressed file. Background Technology
[0002] File Explorer is a file management tool that comes with the operating system. It displays files, folders, disk drives, and other resources on your computer, allowing you to browse and manage them. Files that can be displayed in File Explorer include compressed files.
[0003] A compressed file is created by combining multiple files or folders into a single archive using a specific data compression algorithm. This reduces the disk space occupied by the overall archive, facilitating storage, transmission, and distribution. Because a compressed file is a collection of compressed files, it can contain multiple files or folders, and folders can further contain files or folders, forming a tree-like directory structure. Therefore, users often need to browse the files within a compressed archive and its directory structure, but the Windows Explorer interface cannot display these elements.
[0004] For example, the Windows Explorer preview window can only display the contents of files in a few specific formats. For compressed files such as ".zip", it cannot display a preview, nor can it show the directory structure within the compressed file, thus degrading the user experience. Summary of the Invention
[0005] In view of this, embodiments of this application provide a method and apparatus for displaying the file directory structure within a compressed package, in order to solve the problem that the file explorer interface cannot display the files and file directory structure within a compressed package.
[0006] According to a first aspect of this application, a method for displaying the directory structure of files within a compressed file is provided, the method comprising: In response to a preview command for the target compressed file, obtain the current display position of the preview window in File Explorer; A compressed package display window is created based on the displayed location; Use a decompression tool to read a preview object from the target compressed file. The preview object includes file information and file directory structure within the package. Based on the file directory structure, the file information within the package is loaded into the compressed package display window, which is used to display the file information within the package in a tree structure corresponding to the file directory structure.
[0007] In some embodiments, in response to a preview command for a target compressed file, obtaining the current display position of the file explorer's preview window includes: Receive a preview command for the target compressed file; Upon receiving the preview instruction, the preview processor agent host process is invoked; The preview processor is used to proxy the host process to load the preview processor's dynamic link library files; Based on the dynamic link library file, the current display position of the resource manager's preview window is determined through the preview processor interface.
[0008] In some embodiments, receiving a preview instruction for a target compressed file includes: Monitor the real-time movement of the focus marker in the resource explorer; Based on the real-time movement position, record the duration for which the focus marker stays in the area associated with the target compressed file; When the dwell time reaches a preset time threshold, a preview instruction for the target compressed file is generated.
[0009] In some embodiments, creating a compressed file display window based on the display location includes: The window creation process is invoked through the preview processor interface. The window creation process includes setting up the window process, initializing the process, and executing the preview process. The settings window process is used to set the parent window and display area of the compressed package display window; the parent window is set according to the handle of the current preview window of the resource manager; the display area is set according to the display position. The initialization process initializes the preview handler, so that the execution preview process loads the window rendering data of the compressed package display window and draws the preview content based on the preview handler.
[0010] In some embodiments, reading a preview object from the target compressed file using a decompression tool includes: The decompression tool is invoked, which is an open-source decompression tool invoked according to the file format of the target compressed file; The decompression tool is used to decompress the target compressed file to obtain multiple files within the package. The files within the package are stored in a temporary file space; The command-line tool of the decompression tool is used to traverse the temporary file space to obtain the file information within the package and the file directory structure.
[0011] In some embodiments, the method further includes: Receive the decompression command for the target compressed file; In response to the decompression command, obtain the file release directory specified by the user in the decompression command; Determine the permanent file space based on the file release directory; Move the files within the package from the temporary file space to the permanent file space.
[0012] In some embodiments, based on the file directory structure, loading the file information within the package into the compressed package display window includes: Get the absolute path of the current file previewed in the file explorer and the window handle of the compressed file display window; The content is matched and drawn based on the file information within the package via the graphics device interface; Set the recursive path according to the file directory structure, the window handle, and the absolute path; Based on the recursive path, the drawn content is loaded into the compressed package display window to form a tree-structured preview screen in the compressed package display window.
[0013] In some embodiments, obtaining the absolute path of the current file previewed in the file explorer and the window handle of the compressed file display window includes: Call the file initialization interface, which is used to initialize the preview handler through the file path; Register the preview handler through the file initialization interface; Extract the absolute path of the current Explorer preview file using the preview processing procedure.
[0014] In some embodiments, obtaining the absolute path of the current file previewed in the file explorer and the window handle of the compressed file display window includes: Call the object linking and embedding window interface; The window handle of the compressed package display window is obtained through the object linking and embedded window interface; The window handle is notified to the resource manager process.
[0015] According to a second aspect of this application, a device for displaying the directory structure of files within a compressed file is provided, the device comprising: The location acquisition module is used to obtain the current display position of the preview window in the file explorer in response to a preview command for the target compressed file; A window creation module is used to create a compressed package display window based on the display location; The preview object reading module is used to read the preview object from the target compressed file using a decompression tool. The preview object includes file information and file directory structure within the package. The display module is used to load the file information within the package into the compressed package display window based on the file directory structure. The compressed package display window is used to display the file information within the package in a tree structure corresponding to the file directory structure.
[0016] According to a third aspect of this application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the program to implement the method for displaying the file directory structure within the compressed package described above.
[0017] According to a fourth aspect of this application, a storage medium is provided that stores a computer program thereon, which, when executed by a processor, implements a method for displaying the file directory structure within the aforementioned compressed package.
[0018] By employing the above technical solutions, embodiments of this application provide a method and apparatus for displaying the file directory structure within a compressed archive. The method responds to a preview command for a target compressed archive file, obtains the current display position of the preview window in the resource manager, and creates a compressed archive display window based on that position. Then, a decompression tool reads the preview object from the target compressed archive file, and based on the file directory structure, loads the file information within the archive into the compressed archive display window, thereby displaying the file information in the compressed archive display window in a tree structure corresponding to the file directory structure. This method can create a compressed archive display window based on the current preview window in the resource manager and display the file information in the archive in a tree structure corresponding to the file directory structure, thus intuitively displaying the files and file directory structure within the target compressed archive file and improving the user experience.
[0019] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0020] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a schematic flowchart illustrating the method for displaying the file directory structure within a compressed package as provided in an embodiment of this application. Figure 2 This is a schematic diagram illustrating the file directory structure process provided in the embodiments of this application; Figure 3 This is a schematic diagram of the prevhost process processing flow provided in an embodiment of this application; Figure 4 This is a schematic diagram of the file directory structure provided in an embodiment of this application; Figure 5 This is a schematic diagram illustrating the process of loading file information within a package into a compressed package display window, as provided in an embodiment of this application. Figure 6 This is a schematic diagram of the decompression process according to the decompression command provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of the display device for the file directory structure within the compressed package provided in the embodiments of this application. Detailed Implementation
[0021] The present application will be described in detail below with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in the embodiments of the present application can be combined with each other.
[0022] In this embodiment of the application, the method for displaying the file directory structure within the compressed package can be applied to a computer device, enabling the computer device to preview the file content and file directory structure of the compressed package in a file display interface such as a file explorer, so that the user can know the file content contained in the compressed package.
[0023] File Explorer is a file management tool that comes with the operating system. It displays files, folders, disk drives, and other resources on the computer, allowing users to browse and manage these resources.
[0024] Taking Windows Explorer as an example, Windows Explorer is a built-in file management tool in the Windows operating system. Users can use Windows Explorer to browse and manage files, folders, disk drives, and other resources on their computers. The management operations supported by Windows Explorer include copying, moving, and deleting files, creating new folders, viewing detailed file information such as size, type, and modification date, and accessing network shared resources.
[0025] The File Explorer interface can display various file types, such as text files, audio files, multimedia files, system or program files, and compressed files. Compressed files, in particular, are created by merging multiple files or folders into a single compressed file using specific data compression algorithms. This reduces the overall disk space occupied by the files, facilitating their storage, transfer, and distribution.
[0026] Because a compressed file is a collection of compressed files, it can contain multiple files or folders, and folders can further contain files or folders, forming a tree-like file directory structure. Therefore, users need to browse the files within a compressed file and its directory structure, but the Windows Explorer interface cannot display the files and directory structure within a compressed file.
[0027] For example, the Windows Explorer preview window can only display the contents of files in a few specific formats. For compressed files such as ".zip", it cannot display a preview, nor can it show the directory structure within the compressed file, thus degrading the user experience.
[0028] To address the issue that the file explorer interface cannot display the file and directory structure within a compressed archive, some embodiments of this application provide a method for displaying the file and directory structure within a compressed archive. This method can create a compressed archive display window based on the current preview window of the file explorer and display the file information within the archive in a tree structure corresponding to the file directory structure, thereby intuitively displaying the file and directory structure within the target compressed archive.
[0029] The method can be applied to electronic devices with data processing capabilities. These electronic devices include, but are not limited to, computers, servers, mobile terminals, smart wearable devices, and industrial control machines. For ease of description, electronic devices or computer devices are used as the execution subject of the method in this embodiment. It should be understood that the method can also be applied to other types of execution subjects, which are not illustrated in this embodiment. Figure 1 As shown, the method includes: S101. In response to a preview command for the target compressed file, obtain the current display position of the preview window in the file explorer.
[0030] To display the files and directory structure within the compressed archive, the electronic device can first receive a preview command from the user regarding the target compressed archive file. This preview command is used to preview the target compressed archive file and can be input based on the specific interactive methods supported by the electronic device.
[0031] In some embodiments, when an electronic device supports interaction via input devices such as a mouse, the user can perform interactive operations through the input device and complete the preview command input based on the specific interactive action. For example, when an electronic device such as a computer displays a file explorer interface, the user can operate the mouse to click on the icon of any compressed file in the file explorer interface. When the compressed file icon receives the mouse focus mark, it can be determined that the user has entered a preview command for the selected compressed file (target compressed file).
[0032] In some embodiments, when the electronic device supports touch interaction, the user can perform interactive operations through touch interaction to input preview commands for the target compressed file. For example, when the electronic device is a mobile terminal such as a mobile phone or tablet and displays a file explorer interface, the user can long-press the icon of any compressed file in the file explorer interface to input preview commands for the target compressed file.
[0033] It should be noted that, depending on the type of electronic device and the interaction methods it supports, users can input preview commands in various ways, including but not limited to voice interaction, gesture interaction, and motion-sensing interaction. Specific preview command input methods can be adjusted according to the interaction methods supported by the electronic device and will not be listed individually.
[0034] In some embodiments, the preview command can also be automatically generated and executed based on an intelligent judgment program set in the electronic device's operating system or the file explorer application. For example, according to the default display strategy of the file explorer interface, the first file icon in the file explorer interface receives the focus mark. Therefore, when the first file icon in the file explorer interface is the target compressed file, a preview command can be automatically generated to preview the content of the first file icon.
[0035] In the preview command input and generation method shown in the above embodiments, the target compressed file needs to be determined by the focus marker in the current file explorer interface. Furthermore, since the preview process requires additional data processing by the electronic device, and when the file explorer interface contains a large number of file icons, frequent switching of the focus marker by the user will cause the electronic device to generate preview commands frequently, increasing the data processing complexity and prolonging the preview operation's waiting time.
[0036] Therefore, to reduce the amount of data processing on electronic devices when displaying the file explorer interface, in some embodiments, when receiving a preview command for a target compressed file, the real-time movement position of the focus marker in the file explorer can be monitored. Based on the real-time movement position, the duration for which the focus marker stays in the area associated with the target compressed file is recorded. When the dwell time reaches a preset threshold, a preview command for the target compressed file is generated.
[0037] For example, an electronic device can call the focus monitoring process "GetFocus()" to obtain information about the object currently holding the focus marker, enabling real-time monitoring of the focus marker's movement in the file explorer. When the focus marker is detected in the icon area corresponding to the target compressed file "AA.zip", a timer can be used to record the duration the focus marker stays in the associated area of the target compressed file, obtaining the duration T. AThen, by comparing the duration of stay T... A Compared to a pre-set duration threshold T0 (e.g., 1 second), when the dwell time T A >When the preset duration threshold T0 is reached, a preview command for the "AA.zip" file can be generated.
[0038] like Figure 2 As shown, after receiving a preview command, the electronic device can respond to the preview command and perform a preview operation on the target compressed file. When performing the preview operation, the electronic device first needs to obtain the current display position of the preview window in the file explorer.
[0039] like Figure 3 As shown, in order to obtain the current display position of the preview window in File Explorer, in some embodiments, the electronic device can invoke the Preview Handler Surrogate Host process when it receives a preview command. The Preview Handler Surrogate Host (prevhost) is a preview processing process set up in the shell extension module of the electronic device. It is used to load and manage the dynamic link library (DLL) files of the preview handlers to generate file thumbnails and previews in File Explorer. The prevhost process communicates with the Windows Shell through a COM interface and dynamically loads the corresponding preview handler based on the file extension.
[0040] After invoking the prevhost process, the preview processor's dynamic link library file can be loaded using the preview processor proxy host (prevhost) process. That is, the preview processor DLL is loaded through the prevhost process. When a user opens a folder in File Explorer and needs to display file thumbnails or previews, the prevhost process is started and loads the preview processor DLL corresponding to the file type. The prevhost process can employ a process isolation mechanism, creating independent proxy process spaces to load various file preview handlers, ensuring that the crash of a single preview plugin will not affect the stability of the main File Explorer process.
[0041] Then, based on the dynamic link library file, the display position of the current preview window in File Explorer is determined through the preview handler interface. For example, electronic devices can determine the position of the File Explorer preview window through the preview handler (IPreviewHandler) interface. IPreviewHandler is a COM interface provided by Windows for implementing file preview functionality, allowing applications to display preview content of files in File Explorer. The IPreviewHandler interface defines the basic functionality of the preview handler, allowing the display of preview content of files such as images, documents, and videos in File Explorer.
[0042] In some embodiments, the IPreviewHandler interface can be used to implement various sub-processes, including a SetWindow process, an Initialize process, and a DoPreview process. The SetWindow process sets the parent window handle and preview area of the preview window. The Initialize process initializes the preview handler. The DoPreview process loads data and begins rendering content in the preview window.
[0043] In addition to the aforementioned processes such as setting up the window and executing the preview, the IPreviewHandler interface also enables functions such as unloading the preview, setting preview parameters (SetRect), setting focus (SetFocus), querying focus (QueryFocus), and a translation accelerator (TranslateAccelerator). Unloading the preview releases resources allocated by the preview handler. Setting preview parameters adjusts the size and position of the preview window. Setting focus sets the focus to the preview window. Querying focus retrieves the current focus of the preview window. The translation accelerator handles keyboard messages within the preview window.
[0044] To determine the current display position of the File Explorer preview window, electronic devices can use the `IPreviewHandler` interface to call `SetWindow` to determine the parent window. For example, the parent window can be determined by executing `HRESULTSetWindow(HWND hwndParent, const RECT ×prc)`. Here, `hwndParent` represents the handle of the container window corresponding to the File Explorer, which can be the handle of the File Explorer itself. `prc` represents the desired rectangular window area for the initial placement, i.e., the client area of the window with its top-left corner relative to `hwndParent`. After a successful call, the preview handler will create its child window as a child window of `hwndParent`.
[0045] S102. Create a compressed package display window based on the display location.
[0046] After obtaining the current display position of the file explorer's preview window, the electronic device can create a compressed file display window based on that position. Specifically, in the DoPreview process of the IPreviewHandler interface, a preview window is created to display the contents of the compressed file, i.e., the compressed file display window, based on the current preview window's display position.
[0047] To create a compressed file display window, in some embodiments, when an electronic device creates a compressed file display window based on the display location, it can first call a window creation process through a preview processor interface. This window creation process includes a window setup process, an initialization process, and a preview execution process.
[0048] Next, the settings window process sets the parent window and display area of the compressed file display window. The parent window is set based on the handle of the current preview window in Windows Explorer, while the display area can be set according to the display position. Then, the preview handler is initialized through the initialization process, so that the preview process loads the window rendering data of the compressed file display window based on the preview handler and draws the preview content.
[0049] For example, when implementing the DoPreview method of the IPreviewHandler interface, a compressed package display window can be created based on the display position. Before calling the DoPreview method, SetWindow is called to set the parent window and display area of the compressed package display window, and the Initialize process, such as the file initialization (IInitializeWithFile) process or the stream initialization (IInitializeWithStream) process, is called to initialize the preview handler.
[0050] Then, using the DoPreview process, a compressed file display window is created based on the parent window handle and display area provided by the SetWindow process. During the creation of the compressed file display window, the window class can be registered first by executing "RegisterClassW(&wc); returnHRESULT_FROM_WIN32(GetLastError())". Then, the window size is initialized to 0 by executing "m_hwndPreview=CreateWindowExW(0, L MyPreviewWindowClass, L, WS_CHILD|WS_VISIBLE, 0, 0, 0, 0" and setting "m_hwndParent" to represent the parent window handle; then, the compressed file display window is created by executing GetModuleHandleW(NULL), NULL); if (!m_hwndPreview); returnHRESULT_FROM_WIN32(GetLastError())".
[0051] S103. Use a decompression tool to read the preview object from the target compressed file.
[0052] After creating a compressed file display window, electronic devices can view the contents of the compressed file through this window. Therefore, decompression tools can be used to read the preview object from the target compressed file. The preview object includes file information and the file directory structure within the package.
[0053] The package information indicates the file names, file types, file modification dates, and file sizes contained within the compressed archive. This information can be obtained by reading the compressed archive using a decompression tool. Furthermore, since this information does not involve the actual content of the files within the compressed archive, it can be obtained without decompressing the archive. This allows users to view file information and directory structure within a password-protected compressed archive without uncompressing it, and also avoids the processing time of the decompression process, improving the efficiency of previewing compressed archives.
[0054] The file directory structure is used to indicate the hierarchical relationships between multiple files and folders within a compressed archive, for example, ... Figure 4As shown, a compressed file may include two folders, A and B, and a single file, C. Furthermore, folder A contains files D and E, and folder B contains files F and G. A decompression tool can traverse the folders and files within the compressed file to obtain file information and generate a file directory structure based on the hierarchical relationships between files and folders. To represent the hierarchical relationships between files within the package, the file directory structure can be represented using a tree structure.
[0055] In some embodiments, the electronic device can decompress the target compressed file and list the files within the compressed file to obtain a preview object. That is, when using a decompression tool to read the preview object from the target compressed file, the decompression tool can be invoked first. The decompression tool is an open-source decompression tool invoked according to the file format of the target compressed file, such as open-source libraries like 7z, PeaZip, and FreeArc.
[0056] The target compressed file is then decompressed using a decompression tool to obtain multiple files within the package, which are then stored in a temporary file space. The command-line tool of the decompression tool is then used to traverse the temporary file space to obtain information about the files within the package and the file directory structure.
[0057] For example, an electronic device can be configured with a preview object reading module, which is used to decompress compressed package files and use open-source decompression tools such as 7z. Then, the open-source decompression tool 7z is used to perform decompression to extract the target compressed package file into at least one file within the package.
[0058] To facilitate subsequent file operations such as moving, copying, deleting, and modifying files within the package, the electronic device can store the files within the package to a temporary file space after decompression. This temporary file space refers to a dedicated storage space in the electronic device's memory or hard drive specifically for storing the files within the package. This temporary file space differs from regular memory space, and its storage duration can be set to ensure that the electronic device continuously stores the files within the package while the file manager interface is displayed, facilitating access to the file explorer's preview interface.
[0059] After storing the files within the archive in a temporary file space, electronic devices can use the command-line tool of the decompression tool to traverse the temporary file space, list the files within the archive, and thus obtain information about the files and the file directory structure, which can then be displayed in the archive's display window. For example, you can use the 7-Zip command-line tool "7z l" and execute "7z lAA.7z" to list the files within the archive AA.7z and obtain the file information.
[0060] When files need to be decompressed, users can pre-set the temporary file space address to "D:\Temporary storage space" according to the temporary storage needs. Then, based on the set temporary file space directory, the electronic device can execute "7z x AA.7z -o Temporary storage space" to decompress the files within the compressed file AA.7z to the specified "Temporary storage space" directory. The temporary file space is then traversed to obtain the file information and directory structure within the package, creating a preview object.
[0061] S104. Based on the file directory structure, load the file information within the package into the compressed package display window.
[0062] After reading the preview object from the target compressed file using a decompression tool, the read preview object can be displayed in the compressed file display window. Therefore, electronic devices can load the file information within the package into the compressed file display window based on the file directory structure.
[0063] In order to present the file information within the target compressed file in the compressed file display window and indicate the hierarchical relationship of the files within the package, the preview object can be displayed in the compressed file display window in the form of a tree structure. That is, the compressed file display window is used to display the file information within the package in a tree structure corresponding to the file directory structure.
[0064] In some embodiments, when loading file information within a package into the compressed package display window based on the file directory structure, the absolute path of the current file previewed in the file explorer and the window handle of the compressed package display window can be obtained first.
[0065] The absolute path of the file currently being previewed in File Explorer allows for custom file preview functionality within the Explorer, enabling the loading and display of file content via the absolute path. This can be used, for example, to preview images, documents, or video files. The absolute path can also be used for further processing during file preview, such as extracting metadata, generating thumbnails, or performing other analytical operations.
[0066] To obtain the absolute path of the current file previewed in File Explorer, the electronic device can call the file initialization interface when retrieving the absolute path of the current file preview and the window handle of the compressed file display window. The file initialization interface is used to initialize the preview handler using the file path. Then, the preview handler is registered through the file initialization interface, and the absolute path of the current file previewed in File Explorer is extracted according to the preview handler.
[0067] For example, such as Figure 5 As shown, an electronic device can configure a module to initialize the `IInitializeWithFile` interface, which is used to obtain the absolute path of the current file previewed in the file explorer. In obtaining the absolute path, the electronic device can first define the `IInitializeWithFile` interface to initialize the preview handler using the file path. The `IInitializeWithFile` interface definition can include: `class ATL_NO_VTABLECMyPreviewHandler: public CComObjectRootEx` <ccomsinglethreadmodel>publicCComCoClass<CMyPreviewHandler,&CLSID_MyPreviewHandler> The code defines `public IPreviewHandler` and `public IInitializeWithFile`. Then, it performs initialization based on the defined `IInitializeWithFile` interface. Specifically, in the `Initialize` process, it saves the file path and marks it as initialized. Next, it registers a preview handler to ensure the preview handler is correctly registered in the registry so that Windows Explorer can call the `IInitializeWithFile` interface. Finally, it uses the saved file path in `DoPreview` or other methods to load and display the file content.
[0068] The window handle of the compressed file display window is used to represent the compressed file display window, so that the corresponding preview program in File Explorer can render the content of the compressed file display window based on the window handle. The window handle of the compressed file display window can be notified to the File Explorer process through the Object Linking and Embedded Window (IOleWindow) interface.
[0069] When executing the steps of obtaining the absolute path of the current file previewed by the file explorer and the window handle of the compressed file display window, the object linking and embedding window interface can be called, and then the window handle of the compressed file display window can be obtained through the object linking and embedding window interface, thereby notifying the file explorer process of the window handle.
[0070] For example, an electronic device can be configured with an IOleWindow interface implementation module to notify the file explorer of the handle of the current preview window. When obtaining the window handle of the compressed file display window, a preview handler can be registered. The preview handler is correctly registered in the registry so that the file explorer can call the IOleWindow interface. This involves calling the GetWindow process and related processes such as ContextSensitiveHelp. The preview window handle is then used in the DoPreview process, which loads the file content and displays the preview using the saved preview window handle.
[0071] After notifying the file explorer of the handle of the current preview window, the electronic device then uses the graphics device interface to match the drawing content based on the file information in the package, and sets a recursive path according to the file directory structure, window handle, and absolute path. Based on the recursive path, the drawing content is loaded into the compressed package display window to form a tree-structured preview screen in the compressed package display window.
[0072] For example, electronic devices can use the open-source 7z SDK to list the directory structure within a compressed file and store it in a temporary file space. Then, the absolute path of the currently previewed file in the file explorer is obtained through the `IInitializeWithFile` interface, and the handle of the current preview window is notified to the file explorer through the `IOleWindow` interface. Next, a recursive path is set according to the file directory structure, window handle, and absolute path, and loaded recursively into the compressed file display window. The compressed file display window then displays the file information and directory structure within the compressed file in a tree structure.
[0073] When displaying file information and directory structure within a compressed archive, Direct UI technology can be used to present the directory structure in a tree-like format. Direct UI is a lightweight UI rendering framework where all controls do not actually create HWNDs; instead, the framework handles message distribution and pixel-level self-drawing on the top-level parent window. Direct UI can create only one window to display the compressed archive content, without using standard controls such as buttons and text boxes provided by the operating system. Therefore, the text and images displayed in the compressed archive display window can be rendered and visually presented using the Graphics Device Interface (GDI) to visualize the file information and directory structure within the archive.
[0074] By applying the technical solutions of the above embodiments, the method for displaying the file directory structure within a compressed package described in the above embodiments can create a compressed package display window based on the file explorer interface to preview the file information within the compressed package, thereby intuitively displaying the files within the compressed package and the file directory structure between the files within the package. Since the preview objects presented in the compressed package display window are the file information and file directory structure within the package, it is possible to preview password-protected compressed packages without decompressing them, and the preview effect remains effective after restarting the electronic device or file explorer, improving the user experience.
[0075] In some embodiments, as a refinement and extension of the specific implementation of the above embodiments, and to fully illustrate the specific implementation process of this embodiment, some embodiments of this application also provide a method for displaying the file directory structure within a compressed package. The difference between this method and the above embodiments is that, after performing the step of reading the preview object from the target compressed package file using a decompression tool, it can quickly decompress according to the decompression command input by the user, i.e., as shown... Figure 6 As shown, the method includes: S201, Receive the decompression command for the target compressed file; S202. In response to the decompression command, obtain the file release directory specified by the user in the decompression command; S203. Determine the permanent file space based on the file release directory; S204. Move the files in the package from the temporary file space to the permanent file space.
[0076] The electronic device decompresses the target compressed file using a decompression tool to obtain multiple files within the package and stores them in a temporary file space. Then, it can receive control commands input by the user. When it receives a decompression command to decompress the target compressed file, the electronic device can respond to the decompression command and obtain the file release directory specified by the user in the decompression command.
[0077] For example, a user selects the target compressed file to perform an extraction operation and specifies the storage path for the extracted files, i.e., specifies the file extraction directory as "output_directory". The electronic device can read the user-specified file extraction directory "output_directory" from the decompression command.
[0078] Next, the permanent file space is determined based on the file release directory, and the files within the package are moved from the temporary file space to the permanent file space. For example, if the file release directory is "output_directory" and the corresponding permanent file space is the "E:\AA" folder, then the electronic device can determine that the permanent file space is the storage space allocated to the "E:\AA" folder on the electronic device's hard drive. Then, the files within the package are moved from the temporary file space to the permanent file space. That is, by directly moving the files within the package from the temporary file space "Temporary storage space" to the permanent file space "E:\AA", there is no need to decompress repeatedly, thereby reducing the amount of data processed during the decompression of the compressed package and improving the file decompression efficiency.
[0079] By applying the technical solutions of the above embodiments, the method for displaying the file directory structure within the compressed package described in the above embodiments can respond to the decompression command, obtain the file release directory specified by the user in the decompression command, determine the permanent file space based on the file release directory, and then move the files within the package from the temporary file space to the permanent file space, so that the compressed package files do not need to be decompressed repeatedly, thereby improving the decompression efficiency of the compressed package files, reducing the user's decompression waiting time, and enhancing the user experience.
[0080] In some embodiments, as a specific implementation of the method for displaying the file directory structure within a compressed package as described in the above embodiments, some embodiments of this application also provide a device for displaying the file directory structure within a compressed package, such as... Figure 7 As shown, the device includes: The location acquisition module is used to obtain the current display position of the preview window in the file explorer in response to a preview command for the target compressed file; A window creation module is used to create a compressed package display window based on the display location; The preview object reading module is used to read the preview object from the target compressed file using a decompression tool. The preview object includes file information and file directory structure within the package. The display module is used to load the file information within the package into the compressed package display window based on the file directory structure. The compressed package display window is used to display the file information within the package in a tree structure corresponding to the file directory structure.
[0081] By applying the technical solutions of the above embodiments, the device for displaying the file directory structure within a compressed package as described in the above embodiments includes a location acquisition module, a window creation module, a preview object reading module, and a display module. The location acquisition module can respond to a preview command for the target compressed package file and obtain the display position of the current preview window in the resource manager. The window creation module can create a compressed package display window based on the display position. The preview object reading module then uses a decompression tool to read the preview object from the target compressed package file. The display module then loads the file information within the package into the compressed package display window based on the file directory structure, thereby displaying the file information within the package in a tree structure corresponding to the file directory structure in the compressed package display window. The device can create a compressed package display window based on the current preview window of the resource manager and display the file information within the package in a tree structure corresponding to the file directory structure, thus intuitively displaying the files and file directory structure within the target compressed package file and improving the user experience.
[0082] It should be noted that other corresponding descriptions of the functional units involved in the device for displaying the file directory structure within a compressed package provided in the embodiments of this application can be found in the corresponding descriptions in the method for displaying the file directory structure within a compressed package provided in the above embodiments, and will not be repeated here.
[0083] This application also provides a computer device, specifically a personal computer, server, network device, etc. The computer device includes a bus, processor, memory, and communication interface, and may also include input / output interfaces and a display device. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device stores location information. The network interface of the computer device is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps in the various method embodiments.
[0084] Those skilled in the art will understand that the structure of the computer device described above is only a partial structure related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. A specific computer device may include more or fewer components, or combine certain components, or have different component arrangements.
[0085] In one embodiment, a computer-readable storage medium is also provided, which may be non-volatile or volatile, and a computer program is stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.
[0086] In one embodiment, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0087] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0088] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods.
[0089] Any references to memory, database, or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc.
[0090] Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can take many forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0091] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchain. The processors involved in the embodiments provided in this application may be, but are not limited to, general-purpose processors, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc.
[0092] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0093] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.< / ccomsinglethreadmodel>
Claims
1. A method for displaying the directory structure of files within a compressed file, characterized in that, The method includes: In response to a preview command for the target compressed file, obtain the current display position of the preview window in File Explorer; A compressed package display window is created based on the displayed location; Use a decompression tool to read a preview object from the target compressed file. The preview object includes file information and file directory structure within the package. Based on the file directory structure, the file information within the package is loaded into the compressed package display window, which is used to display the file information within the package in a tree structure corresponding to the file directory structure.
2. The method according to claim 1, characterized in that, In response to a preview command for the target compressed file, obtain the current display position of the preview window in File Explorer, including: Receive a preview command for the target compressed file; Upon receiving the preview instruction, the preview processor agent host process is invoked; The preview processor is used to proxy the host process to load the preview processor's dynamic link library files; Based on the dynamic link library file, the current display position of the resource manager's preview window is determined through the preview processor interface.
3. The method according to claim 2, characterized in that, Receive preview instructions for the target compressed file, including: Monitor the real-time movement of the focus marker in the resource explorer; Based on the real-time movement position, record the duration for which the focus marker stays in the area associated with the target compressed file; When the dwell time reaches a preset time threshold, a preview instruction for the target compressed file is generated.
4. The method according to claim 2, characterized in that, Creating a compressed file display window based on the display location includes: The window creation process is invoked through the preview processor interface. The window creation process includes setting up the window process, initializing the process, and executing the preview process. The settings window process is used to set the parent window and display area of the compressed package display window; the parent window is set according to the handle of the current preview window of the resource manager; the display area is set according to the display position. The initialization process initializes the preview handler, so that the execution preview process loads the window rendering data of the compressed package display window and draws the preview content based on the preview handler.
5. The method according to claim 1, characterized in that, Use a decompression tool to read the preview object from the target compressed file, including: The decompression tool is invoked, which is an open-source decompression tool invoked according to the file format of the target compressed file; The decompression tool is used to decompress the target compressed file to obtain multiple files within the package. The files within the package are stored in a temporary file space; The command-line tool of the decompression tool is used to traverse the temporary file space to obtain the file information within the package and the file directory structure.
6. The method according to claim 5, characterized in that, The method further includes: Receive the decompression command for the target compressed file; In response to the decompression command, obtain the file release directory specified by the user in the decompression command; Determine the permanent file space based on the file release directory; Move the files within the package from the temporary file space to the permanent file space.
7. The method according to claim 1, characterized in that, Based on the file directory structure, the file information within the package is loaded into the compressed package display window, including: Get the absolute path of the current file previewed in the file explorer and the window handle of the compressed file display window; The content is matched and drawn based on the file information within the package via the graphics device interface; Set the recursive path according to the file directory structure, the window handle, and the absolute path; Based on the recursive path, the drawn content is loaded into the compressed package display window to form a tree-structured preview screen in the compressed package display window.
8. The method according to claim 7, characterized in that, Obtain the absolute path of the current file previewed in File Explorer and the window handle of the compressed file display window, including: Call the file initialization interface, which is used to initialize the preview handler through the file path; Register the preview handler through the file initialization interface; Extract the absolute path of the current Explorer preview file using the preview processing procedure.
9. The method according to claim 8, characterized in that, Obtain the absolute path of the current file previewed in File Explorer and the window handle of the compressed file display window, including: Call the object linking and embedding window interface; The window handle of the compressed package display window is obtained through the object linking and embedded window interface; The window handle is notified to the resource manager process.
10. A device for displaying the directory structure of files within a compressed file, characterized in that, The device includes: The location acquisition module is used to obtain the current display position of the preview window in the file explorer in response to a preview command for the target compressed file; A window creation module is used to create a compressed package display window based on the display location; The preview object reading module is used to read the preview object from the target compressed file using a decompression tool. The preview object includes file information and file directory structure within the package. The display module is used to load the file information within the package into the compressed package display window based on the file directory structure. The compressed package display window is used to display the file information within the package in a tree structure corresponding to the file directory structure.