Icons and the Compiler (old versions)
Keywords: ICONS in NT Compiler replace icon
For Icons and the 2001P and 2002 and subsequent versions of the Compiler, see:Icons and Compiler 2001P and 2002
For 2001N and older versions of the compiler...
When using the 32-bit Compiler to add an Icon to an EXE, there are a few rules to follow.
- The Compiler cannot replace the original icon with an icon which has a larger file size.
- The icon must be the standard 32 by 32 icon type. We can't use the niftier high resolution ones.
- The Compiler cannot place a 32-bit Icon on a 16-bit application.
- Icon files cannot be any larger than 766 bytes, and must be named with the standard .ICO file extension.
- Make sure no anti-virus programs are running. They get upset as WinBatch modifes EXE files...
What the compiler does is create an exe, then patches your icon into the exe. If your virus software sees this it can go ballistic...some program is modifying an exe file (the virus software is trained not to let such a thing happen). If this is the case, you must either remove the virus software, or tell it that the Compiler is a trusted program that is allowed to modify exe files.
- Compile to a target local drive rather than to a network drive. You can sometimes get the 'Error installing specified custom icon while trying to compile WIL file' error message when a security setting on the server prevents changes being made to EXEs. For example, Read/Write/Create permissions but not change or modify permissions set on the server would prevent the Compiler from being able to change the icon in the EXE. Compiling to the local drive will bypass this problem, and then you can copy the EXE back up to the server.
Question:
Every time I compile a WinBatch script with an icon file that I have, I get the following error message:Specified is the wrong size: it should be 766 bytes.I have used this icon file with the 16-bit compiler. What is the difference?Answer:
Different compiler. Different EXE format. How big is your ico file? It needs to be exactly 766 bytes.Question (continued):
My ICO file is 326 bytes. I am concerned now that I have to convert all the icons. I realize that it is a new compiler, but why technically handle it differently. Is this a development limitation, or is this a Wilson WindowWare limitation?I would appreciate your input. I cannot understand why it would work with one Compiler and not the other.
If there is no way around this, how do I convert my icon file to work with the 32-bit compiler?
Answer:
It seems to be a a development limitation in the way we preform a horrific patch to the 32 bit exe to slime the new icon in. Instead of the easy format of 16 bit EXE files where we can do something useful, in the 32 bit world we do not try to decode the resource format of the 32 bit exe file and merely patch the icon in using IntControl 37.We need a standard simple 32x32 icon in a 766 byte file.
Multiple Icons in Compiled WB Exes
If you make a shortcut to a compiled Winbatch EXE, and then right click on that shortcut and go to properties, you'll see that a standard Winbatch EXE has optional 5 icons.To replace the icons, use Intcontrol(37... or IconReplace.
The maximum number of icons any Winbatch EXE can have is 5.
Article ID: W12793Filename: Icons and the Compiler (old versions).txt