Software icon replacement method and system based on Windows system
Through the automated icon replacement method and using the console program to replace and clean icons, the problems of complicated icon replacement and poor user experience in the existing technology are solved, and the convenience and efficiency of icon replacement are improved.
Patent Information
- Application Number
- CN202410907636.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2024-10-29
AI Technical Summary
The method of replacing software icons in the existing technology is complicated, has poor user experience, and is difficult to meet the needs of ordinary users. The traditional method requires manual operation, is error-prone, and is time-consuming.
Provides a software icon replacement method based on the Windows system. By responding to the user's icon replacement instructions, it automates the icon replacement process, uses the console program to close the software, reads and replaces the icon data, and clears the icon cache to achieve one-click icon replacement. .
It significantly reduces the operational complexity and time of icon replacement, improves the user experience, and provides an automated, one-click icon replacement method to ensure the convenience and efficiency of the replacement effect.
Smart Images

Figure CN118860554A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of application software design, and in particular to a method and system for replacing software icons based on Windows system. Background Art
[0002] In modern computer operating systems, icons are an important part of software and system interfaces, intuitively showing applications and their functions to users. Especially in Windows operating systems, various software and system function modules have specific logo icons, such as desktop icons, taskbar icons, start menu icons, etc. However, with the update of software versions or changes in brand image, developers or users may need to replace these icons.
[0003] Traditional icon replacement methods usually require manual work, which is cumbersome and prone to errors. Users need to close related software, manually replace icon files, and clean up system memory to ensure that the replacement takes effect. This manual operation is not only time-consuming, but may also result in operation failure or system problems.
[0004] Currently, there are several ways to change the Logo icon in Windows system:
[0005] Manually replace the icon file: Users need to find the corresponding icon file location and manually replace the new icon. This method requires users to have certain technical knowledge, the operation is complicated and prone to errors.
[0006] Use third-party tools: There are some third-party software that can help users change icons, but most tools cannot achieve one-click replacement, and users still need to manually close the software and perform multiple steps.
[0007] Writing scripts: Advanced users may write scripts to automate parts of the replacement process. However, writing and executing scripts requires a high level of technical skills, and different versions of Windows may have different restrictions on script execution.
[0008] Software comes with a replacement function: Some software comes with an icon replacement function, but it is usually limited to the software itself and cannot cover all related icons (such as the taskbar, start menu, etc.).
[0009] These existing technical solutions all have problems of complex operation and poor user experience, and are difficult to meet the needs of ordinary users.
[0010] Therefore, a simple and easy-to-use icon replacement method is currently needed. Summary of the invention
[0011] To solve the above problems, the present invention provides a software icon replacement method and system based on the Windows system, which automatically performs a series of icon replacement operations by responding to icon replacement instructions, thereby providing users with an automated icon replacement method, solving the problems of the existing icon replacement method that is complex to operate, prone to misoperation, and has a poor user experience.
[0012] To achieve the above object, the present invention provides the following technical solutions:
[0013] A method for replacing software icons based on Windows system, comprising the following steps:
[0014] S1. In response to an icon replacement instruction issued by a user, the icon replacement instruction includes the software to be replaced and the new icon data, and the startup item file information of the new icon data and the software to be replaced is stored;
[0015] S2. Call the icon replacement program and close the software to be replaced;
[0016] S3. Use the icon replacement program to read the new icon data, and replace the icon of the software to be replaced with the new icon according to the new icon data;
[0017] S4. Using the icon replacement program to read the startup item file information of the software to be replaced, starting the software to be replaced according to the startup item file information, closing the icon replacement program, and completing the icon replacement.
[0018] Furthermore, in step S1, the new icon data includes a new icon path and a new icon image file.
[0019] Furthermore, in step S3, before using the icon replacement program to read the new icon data, the method further includes: executing a delay instruction, and after the delay ends, using the icon replacement program to read the new icon data.
[0020] Furthermore, the icon changing program is a console application.
[0021] Furthermore, in step S3, after replacing the icon of the software to be replaced with the new icon according to the new icon data, it also includes deleting the original icon cache file of the software to be replaced, and its specific implementation method includes the steps of: closing Windows Explorer, deleting the icon cache database file, the icon thumbnail cache file and the system tray icon cache stored in the registry, and restarting Windows Explorer.
[0022] Further, in step S3, the icon of the software to be replaced is replaced with a new icon according to the new icon data, and its specific implementation method includes: opening the program file of the software to be updated, writing the new icon data into the client program file, replacing the original icon data, and closing the client program file after completing the replacement.
[0023] Furthermore, the specific implementation of opening the program file of the software to be updated includes: using the BeginUpdateResource function to open the client program file.
[0024] Furthermore, the new icon data is written into the client program file to replace the original icon data, and its specific implementation method includes: using the UpdateResource function to write the new icon data into the client program file to replace the original icon data.
[0025] Furthermore, the client program file is closed after the replacement is completed, and its specific implementation method includes: using the EndUpdateResource function to end the resource update.
[0026] Through the above technical scheme, the present invention has the following beneficial effects: icons are replaced through a console program, and the icon cache is automatically cleaned up, providing users with a one-click automated icon replacement method, which can reduce the operational complexity of icon replacement, optimize the user experience, and significantly improve the convenience and efficiency of icon replacement. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 The present invention is a schematic diagram of the overall flow of a method for replacing a software icon based on a Windows system.
[0028] Figure 2 The present invention is a schematic diagram of the structure of a software icon replacement system based on Windows system in an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0030] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0031] Example 1
[0032] See also Figure 1 , a method for replacing a software icon based on a Windows system, comprising the following steps:
[0033] S1. In response to an icon replacement instruction issued by a user, the icon replacement instruction includes the software to be replaced and the new icon data, and the startup item file information of the new icon data and the software to be replaced is stored;
[0034] S2. Call the icon replacement program and close the software to be replaced;
[0035] S3. Use the icon replacement program to read the new icon data, and replace the icon of the software to be replaced with the new icon according to the new icon data;
[0036] S4. Using the icon replacement program to read the startup item file information of the software to be replaced, starting the software to be replaced according to the startup item file information, closing the icon replacement program, and completing the icon replacement.
[0037] In an optional embodiment, in step S1, the new icon data includes a new icon path and a new icon image file.
[0038] Define a property named DirectoryPath to record the new icon path and other file paths. Define a property named _logoImage to save the image file of the new icon.
[0039] When the user clicks the "Import Logo" button, a file selection dialog box will open, allowing the user to select a new icon. After the user completes the selection, the system will store the image file of the selected icon in the _logoImage property and display a preview of the new Logo icon on the user interface.
[0040] The above new icon path is saved in a specific folder under the user's document directory and stored in the corresponding file in JSON format. In the subsequent replacement program, the program will read and parse the path information. When the path information is invalid or the reading fails, the program will terminate the current operation to avoid subsequent execution errors.
[0041] In an optional embodiment, in step S3, before using the icon replacement program to read the new icon data, it also includes: executing a delay instruction, and after the delay ends, using the icon replacement program to read the new icon data.
[0042] By delaying before reading and replacing, the delay time set here can be 2 seconds to ensure that the software to be replaced is completely closed before continuing with subsequent steps, avoiding replacement operations when the file is occupied.
[0043] In an optional embodiment, the icon changing program is a console application.
[0044] The console program can use the Windows API to modify the software icon using related functions. In actual use, we pass the path of the new icon to be replaced to this API and replace the new Logo icon with the currently displayed selected icon.
[0045] In an optional embodiment, in step S3, after replacing the icon of the software to be replaced with the new icon according to the new icon data, it also includes deleting the original icon cache file of the software to be replaced, and its specific implementation method includes the steps of: closing Windows Explorer, deleting the icon cache database file, the icon thumbnail cache file and the system tray icon cache stored in the registry, and restarting Windows Explorer.
[0046] Closing Windows Explorer ensures that icon cache files can be safely deleted and updated, because Explorer will lock the above files, making them unable to be modified or deleted normally.
[0047] First remove the hidden, system, and read-only attributes of the icon cache database file so that it can be deleted.
[0048] Then, force delete the icon cache database file (IconCache.db) to ensure that the system no longer uses the old icon cache. This deletion overwrites all the system's stored icon caches, ensuring that any old icons are cleared.
[0049] Next, remove the hidden, system, and read-only attributes of all files and folders in the Explorer directory. This step ensures that these files can be deleted. Then delete all thumbnail cache files in the Explorer directory. These files cache icons and thumbnails of various sizes, including 32x32, 96x96, 102x102, 256x256, 1024x1024, and other different sizes of thumbnails. Deleting these files ensures that the system does not use any old icon thumbnails.
[0050] Finally, delete the registry key values that store the system tray icons. The system tray remembers the icons that have been displayed before, and the cache of these icons is stored in the registry. Deleting these registry keys can clear the old icons remembered in the system tray and ensure that new icons can be displayed. The specific registry keys deleted include IconStreams and PastIconsStream, which store the current and past system tray icon data respectively.
[0051] After completing the above deletion steps, restart Windows Explorer so that the system can load the new icon cache and apply the new icons immediately.
[0052] By clearing the cache files in the system, you can ensure that the update of the new icon can take full effect and avoid the existence of old icons left over due to the system cache.
[0053] A batch file is set up, which includes instructions for deleting the icon cache database file, the icon thumbnail cache file, and the system tray icon cache stored in the registry. By clearing the cache, the replaced icon can take effect immediately, ensuring that the user receives the icon update effect immediately.
[0054] In an optional embodiment, in step S3, the icon of the software to be replaced is replaced with a new icon based on the new icon data, and its specific implementation method includes: opening the program file of the software to be updated, writing the new icon data into the client program file, replacing the original icon data, and closing the client program file after completing the replacement.
[0055] After completing the icon replacement and system cache cleanup, the program automatically closes itself. This step ensures that after all replacement operations are completed, resources are released and the system can smoothly apply the new icon configuration.
[0056] In an optional embodiment, the specific implementation of opening the program file of the software to be updated includes: using the BeginUpdateResource function to open the client program file.
[0057] In an optional embodiment, the new icon data is written into the client program file to replace the original icon data, and its specific implementation method includes: using the UpdateResource function to write the new icon data into the client program file to replace the original icon data.
[0058] In an optional embodiment, the client program file is closed after the replacement is completed, and its specific implementation method includes: using the EndUpdateResource function to end the resource update.
[0059] Example 2
[0060] See also Figure 2 , a software icon replacement system based on Windows system, comprising:
[0061] An icon storage module, for responding to an icon replacement instruction issued by a user, wherein the icon replacement instruction includes the software to be replaced and new icon data, and storing the new icon data and the startup item file information of the software to be replaced;
[0062] A program calling module, used for calling an icon changing program and closing the software to be changed;
[0063] The icon replacement module is used to read the new icon data by using the icon replacement program, and replace the icon of the software to be replaced with the new icon according to the new icon data;
[0064] The icon update module is used to use the icon replacement program to read the startup item file information of the software to be replaced, start the software to be replaced according to the startup item file information, close the icon replacement program, and complete the icon replacement.
[0065] The embodiment disclosed in this specification is only an example of a unilateral feature of the present invention, and the protection scope of the present invention is not limited to this embodiment, and any other functionally equivalent embodiments fall within the protection scope of the present invention. For those skilled in the art, various other corresponding changes and deformations can be made according to the technical solutions and concepts described above, and all of these changes and deformations should fall within the protection scope of the claims of the present invention.
Claims
1. A method for replacing software icons based on Windows system, characterized in that: The following steps are involved: S1. In response to an icon replacement instruction issued by a user, the icon replacement instruction includes the software to be replaced and the new icon data, and the startup item file information of the new icon data and the software to be replaced is stored; S2. Call the icon replacement program and close the software to be replaced; S3. Use the icon replacement program to read the new icon data, and replace the icon of the software to be replaced with the new icon according to the new icon data; S4. Using the icon replacement program to read the startup item file information of the software to be replaced, starting the software to be replaced according to the startup item file information, closing the icon replacement program, and completing the icon replacement.
2. A method for replacing software icons based on Windows system according to claim 1, characterized in that: In step S1, the new icon data includes a new icon path and a new icon image file.
3. The method for replacing software icons based on Windows system according to claim 1, characterized in that: In step S3, before using the icon replacement program to read the new icon data, the method further includes: executing a delay instruction, and after the delay is over, using the icon replacement program to read the new icon data.
4. The method for replacing software icons based on Windows system according to claim 1, characterized in that: The icon changing program is a console application.
5. A method for replacing software icons based on Windows system according to claim 4, characterized in that: In step S3, after replacing the icon of the software to be replaced with the new icon according to the new icon data, it also includes deleting the original icon cache file of the software to be replaced. The specific implementation method includes the steps of closing Windows Explorer, deleting the icon cache database file, the icon thumbnail cache file and the system tray icon cache stored in the registry, and restarting Windows Explorer.
6. A method for replacing software icons based on Windows system according to claim 5, characterized in that: In step S3, the icon of the software to be replaced is replaced with a new icon according to the new icon data. The specific implementation method includes: opening the program file of the software to be updated, writing the new icon data into the client program file, replacing the original icon data, and closing the client program file after the replacement is completed.
7. A method for replacing software icons based on Windows system according to claim 6, characterized in that: The specific implementation of opening the program file of the software to be updated includes: using the BeginUpdateResource function to open the client program file.
8. The method for replacing software icons based on Windows system according to claim 6, characterized in that: The specific implementation of writing the new icon data into the client program file to replace the original icon data includes: using the UpdateResource function to write the new icon data into the client program file to replace the original icon data.
9. The method for replacing software icons based on Windows system according to claim 6, characterized in that: The client program file is closed after the replacement is completed, and its specific implementation method includes: using the EndUpdateResource function to end the resource update.
10. A software icon replacement system based on Windows system, characterized in that: include: An icon storage module, for responding to an icon replacement instruction issued by a user, wherein the icon replacement instruction includes the software to be replaced and new icon data, and storing the new icon data and the startup item file information of the software to be replaced; A program calling module, used for calling an icon changing program and closing the software to be changed; The icon replacement module is used to read the new icon data by using the icon replacement program, and replace the icon of the software to be replaced with the new icon according to the new icon data; The icon update module is used to use the icon replacement program to read the startup item file information of the software to be replaced, start the software to be replaced according to the startup item file information, close the icon replacement program, and complete the icon replacement.
