Building Windows Applications with HTA

on Tuesday, 14 June 2011. Posted in How To

Not too long ago, a client came with a request: build a menu for a CD that autoruns and lets the user choose which applications they'd like to install from a list.  This menu would need to work on all window's OS's.

VB seemed like the popular route for these types of menu.  In VB, it's easy to design the form, access the Task Manager, and launch external apps.  The downside is all VB apps have dependencies, whether it's DLL's, OCX's, or the .Net framework--each VB app would require extra space on the CD for these files.

That's when a forum introduced me to HTML Applications, i.e."HTAs."  These are one of the coolest little things I've seen in a while.  After tooling around with some HTA source, I had the application ready to go in less than an hour, looking and acting just how I wanted without dependencies.

So what are HTAs?

HTAs are HTML pages that run as windows-based applications and aren't constrained by browser security.  They're essentially applications written in HTML and/or some scripting language that can access Windows Task Manager and be used for opening programs, interacting with your operating system, and more.  They can be stylized to look just like an application (with their own options for icon, menu bar, size, etc.), but are entirely coded in HTML. 

You can see one in action for yourself.  Just save any html file on your windows-based machine with the extension .hta and open it.

So how are HTA apps different from HTML?

In addition to allowing HTML code, HTA's provide a space for references in the HEAD tag to define the style of the application. 

For instance, the following code will define the icon for the HTA, the default window state, and whether or not it shows in the task bar:

<TITLE>My Sample Application</TITLE>

For a full list of references, visit:

After defining the references, you can do everything in an HTA you can in HTML.  You have full access to CSS, HTML, Javascript, VBscript, etc. which you could use to build the functionality and design of your app.

In terms of functionality, the limit of the application is solely defined by the limit of your scripts.  To get an idea of the sort of app you can develop, check out The HTA Helpomatic which will automatically generate usable source code for you (not to mention it's an HTA itself!)

So what kind of projects are HTA's good for?

  • Creating quick links for applications and web links in one interface
  • Creating an interface for network admins to run common scripts
  • Launching applications in an autorun menu

. . . and plenty more.

This is definitely a neat way for a non-programmer to develop a map of different applications across the system and deploy it with all required files included in the source itself.

Social Bookmarks

phone: 215.948.2380