Microsoft HTA/Window styles and attributes

From Computernewb Wiki
Jump to navigation Jump to search
< Microsoft HTA/Basic concepts!Microsoft HTA/CSS and JavaScript >


HTA has a variety of different attributes for styling the page. You already know about the APPLICATIONNAME attribute from the last part of the tutorial, so it should be easy to learn the other attributes. Most attributes are booleans where "yes" is true and "no" is false, but others accept multiple options. Surround all attribute values in double quotes.

Functional attributes

There are multiple attributes which can modify the window's function.

  • ID: Sets an ID for the HTA program. This attribute's uses will be explained later on.
  • CONTEXTMENU: Determines whether clicking the right mouse button will show the context menu.
  • MINIMIZEBUTTON: Determines whether the minimize button is shown or not.
  • MAXIMIZEBUTTON: Determines whether the maximize button is shown or not.
  • SCROLL: Determines whether the scroll bar is shown or not.
  • NAVIGABLE: Determines whether a linked page loads in the HTA window or in a new browser window.
  • VERSION: Sets the version of the HTA application.
  • SELECTION: Determines whether the text in the window can be selected or not.
  • SINGLEINSTANCE: Determines whether the application can only have a single instance running or not.
  • SHOWINTASKBAR: Determines whether the application shows in the taskbar.

Style attributes

Most other attributes are related to the window's style.

  • APPLICATIONNAME: Sets the program's title.
  • ICON: Sets the program's icon. Accepts the name of an .ico file located in the same folder as the HTA program.
  • CAPTION: Determines whether the program displays a title bar or not.
  • BORDER: Determines which border type the window has. Options: thick, thin, dialog, none.
  • BORDERSTYLE: Determines which border style the window has. Options: normal, raised, sunken, static, complex.
  • INNERBORDER: Determines whether the inner border shows or not.
  • SCROLLFLAT: Determines whether the scroll bar is flat or 3D.
  • WINDOWSTATE: Sets the initial size of the window. Options: maximize, minimize.

Using attributes

Attributes are simple to use: just put them in the HTA:APPLICATION element like this:

Language: HTA
<HTA:APPLICATION
  APPLICATIONNAME = "My Application"
  ICON = "myapp.ico"
  VERSION = "1.0"
  WINDOWSTATE = "maximize"
  SCROLL = "no"
  SELECTION = "no"
  SHOWINTASKBAR = "yes"
/>