Replacing Windows App Icons with Custom Ones: A Comprehensive Guide
Windows apps come with default icons, and sometimes, these icons may not be to our liking. This article will guide you through the process of replacing the default icons of your Windows apps with custom ones. We will be using the MoveFileEx() function to achieve this.
Understanding the MoveFileEx() Function
The MoveFileEx() function is a built-in Windows API that allows you to move or rename files and directories. This function can also be used to replace file icons. The syntax for the function is as follows:
BOOL MoveFileEx(
LPCTSTR lpExistingFileName,
LPCTSTR lpNewFileName,
DWORD dwFlags
);In this case, we will be using the MOVEFILE_REPLACE_EXISTING flag, which will replace the existing file with the new file. The new file will contain the custom icon that we want to use.
Creating a Custom Icon
Before we can replace the default icon, we need to create a custom icon. There are many tools available online that can help you create a custom icon. Once you have created your custom icon, save it as an .ico file.
Replacing the Default Icon
Now that we have our custom icon, we can replace the default icon of the Windows app. Follow the steps below to replace the default icon:
- Locate the app's executable file in the Windows Apps folder. The folder is usually located in
C:\Program Files\WindowsApps. - Make a backup of the executable file.
- Create a new file with the same name as the executable file and add the
.bakextension. For example, if the executable file is namedPictureFlect.exe, create a new file namedPictureFlect.exe.bak. - Open a command prompt as an administrator and navigate to the Windows Apps folder.
- Use the
MoveFileEx()function to replace the executable file with the backup file. The syntax for the command is as follows:MoveFileEx "PictureFlect.exe" "PictureFlect.exe.bak" MOVEFILE_REPLACE_EXISTING - Create a new file with the same name as the executable file and add the
.exeextension. For example, if the executable file is namedPictureFlect.exe.bak, create a new file namedPictureFlect.exe. - Open the new file in a hex editor. You can use a tool like HxD to open the file.
- Search for the string
VarFileInfoand replace it with the stringVarFileInfo<3>. This will add a new icon to the file. - Search for the string
StringFileInfoand replace it with the stringStringFileInfo<040904B0>. This will set the language of the file to English (United States). - Add the following lines of code to the file to set the custom icon:
StringFileInfo<040904B0> [Version] Signature="$CHICAGO$" [Strings] IconFile = "custom\_icon.ico" - Save the file and exit the hex editor.
- Use the
MoveFileEx()function to replace the backup file with the new file. The syntax for the command is as follows:MoveFileEx "PictureFlect.exe.bak" "PictureFlect.exe" MOVEFILE_REPLACE_EXISTING
In this article, we have covered the process of replacing the default icon of a Windows app with a custom one. We have used the MoveFileEx() function to achieve this. We have also covered the steps to create a custom icon and add it to the Windows app executable file.