IE 5.0 Review, Part V: HTML Applications (HTAs); Customizing HTAs - www.docjavascript.com | WebReference

IE 5.0 Review, Part V: HTML Applications (HTAs); Customizing HTAs - www.docjavascript.com


IE 5.0 Review, Part V: HTML Applications (HTAs) (6)

Customizing HTAs

You have previously seen the HTA's window. Click here to examine it again. This window can be further customized to your taste by the HTA:APPLICATION tag. Its attributes tell the window how to appear and behave as an application. The HTA:APPLICATION tag should be included in the <HEAD> section of the HTA. Let's take an example:

<HEAD>
  <TITLE> My Simple Application</TITLE>
  <HTA:APPLICATION ID = "htaObj"
     APPLICATOINNAME = "docjavascript"
     BORDER = "none"
     CAPTION = "no"
     SHOWINTASKBAR = "yes"
     SINGLEINSTANCE = "yes"
     SYSMENU = "no"
     WINDOWSTATE  = Maximize
  >
</HEAD>

All attributes can be accessed from JavaScript via an HTA object identified by the ID attribute. The following script prints the name of the HTA application:

<HTML>
<HEAD>
  <TITLE> My Simple Application</TITLE>
  <HTA:APPLICATION ID = "htaObj"
     APPLICATIONNAME = "docjavascript"
  >
</HEAD>
<SCRIPT>
      alert("applicationName = " + htaObj.applicationName);
   </SCRIPT>
<BODY>
This is Doc JavaScript's HTA<BR>
<BUTTON onclick="self.close()">Go Away</BUTTON>
</BODY>
&lt/HTML>

The following table summarizes all attributes and properties and how they affect the look and feel of the HTA window:


HTML AttributeAPPLICATIONNAME
DescriptionSets (retrieves in JavaScript) the application name.
Possible ValuesA String
ExamplesAPPLICATIONNAME= "docjavascript"
RemarksMust be set and unique for the SINGLEINSTANCE to work.
JavaScript PropertyapplicationName
PermissionRead Only
DefaultNo
HTML AttributeBORDER
DescriptionSets or retrieves the HTA border.
Possible Values"thick", "dialog window", "thin", "none"
ExamplesBORDER= "thin"
RemarksOnly valid for HTA windows that contain a title bar, or caption. The value "none" eliminates the program icon and Minimize/Maximize buttons. Can be used with the borderStyle property, which controls the content border within the window. Differences may not be detected.
JavaScript Propertyborder
PermissionRead Only
Default"thick"
HTML AttributeBORDERSTYLE
DescriptionSets or retrieves the HTA content border.
Possible Values"normal", "complex", "raised", "static", "sunken"
ExamplesBORDERSTYLE= "normal"
RemarksAffects only the content border. Use BORDER to affect the outer border of the window.
JavaScript PropertyborderStyle
PermissionRead Only
Default"normal"
HTML AttributeCAPTION
DescriptionSets or determines whether the HTA window has a title bar.
Possible Values"yes", "no"
ExamplesCAPTION = "yes"
RemarksTurning off the caption will remove the application icon, and the Minimize and Maximize buttons. Provide a button to exit the application!
JavaScript Propertycaption
PermissionRead Only
Default"yes"
HTML AttributecommandLine
DescriptionRetrieves the command line and arguments that invoked the HTA.
Possible ValuesRead Only
Examplescommand = htaObj.commandLine
RemarksReturns an empty string when HTA invoked via HTTP.
JavaScript PropertycommandLine
PermissionRead Only
DefaultNo Default
HTML AttributeICON
DescriptionSets or retrieves the icon file name.
Possible ValuesA String
ExamplesICON = "3DSmiley.ico"
RemarksNeed to use a 32x32 icon.
JavaScript Propertyicon
PermissionRead Only
DefaultSystem Application Icon
HTML AttributeMAXIMIZEBUTTON
DescriptionSets or determines whether the HTA window has a Maximize button.
Possible Values"yes", "no"
ExamplesMAXIMIZEBUTTON = "yes"
RemarksMust turn on CAPTION to have the Maximize button.
JavaScript PropertymaximizeButton
PermissionRead Only
Default"yes"
HTML AttributeMINIMIZEBUTTON
DescriptionSets or determines whether the HTA window has a Minimize button.
Possible Values"yes", "no"
ExamplesMINIMIZEBUTTON = "yes"
RemarksMust turn on CAPTION to have the Maximize button.
JavaScript PropertyminimizeButton
PermissionRead Only
Default"yes"
HTML AttributeSHOWINTASKBAR
DescriptionSets or determines whether the HTA appear in the task bar.
Possible Values"yes", "no"
ExamplesSHOWINTASKBAR = "yes"
RemarksDoes not affect the applications shown by ALT+TAB
JavaScript PropertyshowInTaskBar
PermissionRead Only
Default"yes"
HTML AttributeSINGLEINSTANCE
DescriptionSets or determines whether only one instance of the application is allowed.
Possible Values"yes", "no"
ExamplesSINGLEINSTANCE = "no"
RemarksApplication is determined by APPLICATONNAME and not by the URL. Click twice on the links to the left.
JavaScript PropertysingleInstance
PermissionRead Only
Default"no"
HTML AttributeSYSMENU
DescriptionSets or determines whether the HTA has system menus (icon and Maximize and Minimize buttons).
Possible Values"yes", "no"
ExamplessysMenu = "yes"
RemarksCan drastically affect the look and feel of the application.
JavaScript PropertysysMenu
PermissionRead Only
Default"yes"
HTML AttributeVERSION
DescriptionSets or determines the HTA version.
Possible ValuesA String
Examplesversion = "5.3"
RemarksThe entered version will appear in the application's properties, if you save to disk.
JavaScript Propertyversion
PermissionRead Only
Default""
HTML AttributeWINDOWSTATE
DescriptionSets or determines the HTA window size.
Possible Values"normal", "maximize", "minimize"
ExamplesWINDOWSTATE = "minimize"
Remarks"normal" means window will inherit the Internet Explorer default window. "maximize" will expand the window to a full screen. "minimize" will put the application icon on the task bar.
JavaScript PropertywindowState
PermissionRead Only
Default"normal"


http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran

Created: May 12, 1999
Revised: May 12, 1999

URL: http://www.webreference.com/js/column39/customize.html