Adding a Task Bar Icon to Our hta File

A little bit of html knowledge is going to be a big help with hta files. One of the abilities within html is to use relative pathing to set the location on files, directories and more. These paths all relate back to where you're running your hta file from.

For instance, as you may have noticed from our first example hta, once started there is no real icon for it on the Windows task bar. This may not worry many, but I remember doing a presentation to a large groups of CAD Managers on how the builds I do work and how the hta works with the build and the only response I got was that it wasn't pretty enough :-/ So, one way to 'make it prettier' is to make sure that we have an icon on the button bar that is obvious. Company logos, anything that will give it a better look than the page icon Windows 7 uses as default.

To add the icon we add an 'icon=' option to our application section in the hta file. We looked at this back in Part 1 of our hta tutorials.

<hta:application id="GDFT2dev"
applicationname="_CADmanage"
icon="img\office.ico"
border="thin"
caption="yes"
maximizebutton="yes"
minimizebutton="yes"
scroll="no"
singleinstance="yes"
windowstate="normal"
sysmenu="yes">
</hta:application>

Using 'icon="img\office.ico"' means that where ever we have our hta file, the hta will look for a file called office.ico in an 'img' directory in the same location as the hta file. This is where the relative pathing works so well and starts to make the hta files much more transportable. Later on we'll see how this relative pathing can be applied to other variables within our hta.

More soon.