Class IconExe
- java.lang.Object
-
- daevil.iconexe.IconExe
-
public class IconExe extends java.lang.ObjectCustomize the icon of a Windows exeWARNING! This class is not part of SWT API. It is NOT API. It is an internal tool that may be changed or removed at anytime.
Based on MSDN "An In-Depth Look into the Win32 Portable Executable File Format".
Win x64 support (Bug #238001) based on MSDN "x64 Primer: Everything You Need To Know To Start Programming 64-Bit Windows Systems".
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIconExe.BITMAPINFOHEADERstatic classIconExe.CURSORDIRstatic classIconExe.FileFormatstatic classIconExe.ICONRESDIRstatic classIconExe.IconResInfostatic classIconExe.IMAGE_DATA_DIRECTORYstatic classIconExe.IMAGE_DOS_HEADERstatic classIconExe.IMAGE_FILE_HEADERstatic classIconExe.IMAGE_NT_HEADERSstatic classIconExe.IMAGE_OPTIONAL_HEADERstatic classIconExe.IMAGE_RESOURCE_DATA_ENTRYstatic classIconExe.IMAGE_RESOURCE_DIRECTORYstatic classIconExe.IMAGE_RESOURCE_DIRECTORY_ENTRYstatic classIconExe.IMAGE_SECTION_HEADERstatic classIconExe.NEWHEADERstatic classIconExe.RESDIR
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringVERSION
-
Constructor Summary
Constructors Constructor Description IconExe()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcopyFile(java.lang.String src, java.lang.String dst)static java.util.List<daevil.iconexe.IconExe.ImageData>exeIconsFromPng(java.lang.String program, java.lang.Object imgFile)nasty little deal to create matching exe images from a png filestatic java.awt.image.BufferedImagegetBuff(daevil.iconexe.IconExe.ImageData data)static voidmain(java.lang.String[] args)Replace the Desktop icons provided in the Windows executable program with matching icons provided by the user.static voidsetIcon(java.io.File exe, java.io.File ico)static voidsetIcon(java.io.File exe, java.lang.String resourcePath)
-
-
-
Field Detail
-
VERSION
public static final java.lang.String VERSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.lang.ExceptionReplace the Desktop icons provided in the Windows executable program with matching icons provided by the user.Takes 2 arguments argument 0: the Windows executable e.g c:/eclipse/eclipse.exe argument 1: The .ico file to write to the given executable e.g. c:/myApp.ico
Note 1. Write access to the executable program is required. As a result, that program must not be currently running or edited elsewhere.
Note 2. The Eclipse 3.4 launcher requires an .ico file with the following 7 images (in any order). 1. 48x48, 32 bit (RGB / Alpha Channel) 2. 32x32, 32 bit (RGB / Alpha Channel) 3. 16x16, 32 bit (RGB / Alpha Channel) 4. 48x48, 8 bit (256 colors) 5. 32x32, 8 bit (256 colors) 6. 24x24, 8 bit (256 colors) 7. 16x16, 8 bit (256 colors)
Note 3. The Eclipse 4.2 launcher requires an .ico file with the following 7 images (in any order). 1. 256x256, 32 bit (RGB / Alpha Channel) 2. 48x48, 32 bit (RGB / Alpha Channel) 3. 32x32, 32 bit (RGB / Alpha Channel) 4. 16x16, 32 bit (RGB / Alpha Channel) 5. 48x48, 8 bit (256 colors) 6. 32x32, 8 bit (256 colors) 7. 16x16, 8 bit (256 colors)
A user icon matching exactly the width/height/depth of an executable icon will be written to the executable and will replace that executable icon. If an executable icon does not match a user icon, it is silently left as is.
Note 4. This function modifies the content of the executable program and may cause its corruption.
- Parameters:
args- woo- Throws:
java.lang.Exception- wwwjava.io.IOException- eee
-
setIcon
public static void setIcon(java.io.File exe, java.lang.String resourcePath) throws java.lang.Exception- Throws:
java.lang.Exception
-
setIcon
public static void setIcon(java.io.File exe, java.io.File ico) throws java.lang.Exception- Throws:
java.lang.Exception
-
exeIconsFromPng
public static java.util.List<daevil.iconexe.IconExe.ImageData> exeIconsFromPng(java.lang.String program, java.lang.Object imgFile) throws java.io.IOExceptionnasty little deal to create matching exe images from a png file- Parameters:
program- the Windows executable e.g c:/eclipse/eclipse.exeimgFile- png file (256x256) to create icons from- Returns:
- icons matching format for those in the executable
- Throws:
java.io.IOException- io error
-
getBuff
public static java.awt.image.BufferedImage getBuff(daevil.iconexe.IconExe.ImageData data)
-
copyFile
public static void copyFile(java.lang.String src, java.lang.String dst) throws java.io.FileNotFoundException, java.io.IOException- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
-