Softwares

Design Windows GUI Applications Using Html

You can design small applications very easily if you have knowledge on Html, CSS and JavaScript. To see an sample HTA application just rename .html or .htm page to .hta. Then application is ready as hta application.

I will explain you briefly with an example

<html>
<head>
<title>Arithmetic Operations</title>
<script>
function validate() {
var x=document.getElementById(“a”).value;
var y=document.getElementById(“b”).value;
if (x==”” || isNaN(x) || y==”” || isNaN(y) )
{
alert(“Enter a valid number”);
return false;
}
return true;
}
function add() {
var x=new Number(document.getElementById(“a”).value);
var y=new Number(document.getElementById(“b”).value);
var z=x+y
if(validate())
alert(“Result of addition is “+z);
}
function sub() {
var x=new Number(document.getElementById(“a”).value);
var y=new Number(document.getElementById(“b”).value);
var z=x-y
if(validate())
alert(“Result of sbtraction is “+z)
}
function mul() {
var x=new Number(document.getElementById(“a”).value);
var y=new Number(document.getElementById(“b”).value);
var z=x*y
if(validate())
alert(“Result of multiplication is “+z)
}
function divide() {
var x=new Number(document.getElementById(“a”).value);
var y=new Number(document.getElementById(“b”).value);
var z=x/y
if(validate())
alert(“Result of devition is “+z)
}
</script>
</head>
<body>
Enter 1st number <input type=”text” id=”a” /><br>
Enter 2nd number <input type=”text” id=”b” /><br><br>
<input type=”button” onclick=”add();” value=”add” />
<input type=”button” onclick=”sub();” value=”Subtract” />
<input type=”button” onclick=”mul();” value=”multiply” />
<input type=”button” onclick=”divide();” value=”devide” />

</body>
</html>

Copy this code and save as .html file.
Example: “operations.html”
Note: do not save as operations.html.txt (set all file types in notepad before saving).
Open this will act as a web page.

Copy this code and save as .hta file.
Example: “operations.hta”
Note: do not save as operations.hta.txt(set all file types in notepad before saving)
Open this will act as a application

Briefly about hta

HTA applications are nothing but programs (based on html, css, JavaScript, ASP, VBSCRIPT, ASP.NET, WSH) that opened by internet explorer. These applications will support all functionalities of IIS Server (Internet Information services which comes by default with windows operating system) like VBSCRIPT (visual basic scripting), ASP (Active Server Pages) and Active x support (Microsoft JSCRIPT) and WSH (Windows Script Host) along with HTML,CSS and JavaScript.

Note VBSCRIPT and ASP are Server Side Scripting languages for web design which will not work when you test with your browser and will only work when they are as HTA applications whereas applications written with html,css and JavaScript can be tested in your browser.

Special commands will help you make better look of programs

property value
applicationName “name”
border “thick” or “dialog” or “none” or “thin”
borderStyle “static”or”raised”or”normal”or”sunken”or”complex”
caption “yes” or “no”
commandLine
contextMenu “yes” or “no”
icon “address of .ico image”
innerBorder “yes” or “no”
maximizeButton “yes” or “no”
minimizeButton “yes” or “no”
navigable “yes” or “no”
scroll “yes” or “no”
scrollFlat “yes” or “no”
selection “yes” or “no”
showInTaskBar “yes” or “no”
sysMenu “yes” or “no”
version 1.0
windowState “minimize” or “maximize” or “normal”

HTML Applications Reference

HTA:

Enables an extended object model for building HTML Applications (HTA).

Attributes/Properties APPLICATION

Indicates whether the content of the object is an HTML Application (HTA), which is exempt from the security model.

ApplicationName

Sets or gets the name of the HTML Application (HTA).

Border

Sets or gets the type of window border for the HTML Application (HTA).

BorderStyle

Sets or gets the style set for the content border in the HTML Application (HTA) window.

Caption

Sets or gets a Boolean value that indicates whether the window is set to display a title bar or a caption, for the HTML Application (HTA).

CommandLine

Gets the argument used to launch the HTML Application (HTA).

ContextMenu

Sets or gets a string value that indicates whether the context menu is displayed when the right mouse button is clicked.

Icon

Sets or gets the name and location of the icon specified in the HTML Application (HTA).

InnerBorder

Sets or gets a string value that indicates whether the inside 3-D border is displayed.

MaximizeButton

Sets or gets a Boolean value that indicates whether a Maximize button is displayed in the title bar of the HTML Application (HTA) window.

MinimizeButton

Sets or gets a Boolean value that indicates whether a Minimize button is displayed in the title bar of the HTML Application (HTA) window.

Navigable

Sets or gets a string value that indicates whether linked documents are loaded in the main HTA window or in a new browser window.

Scroll

Sets or gets a string value that indicates whether the scroll bars are displayed.

ScrollFlat

Sets or gets a string value that indicates whether the scrollbar is 3-D or flat.

Selection

Sets or gets a string value that indicates whether the content can be selected with the mouse or keyboard.

ShowInTaskBar

Sets or gets a value that indicates whether the HTML Application (HTA) is displayed in the Windows taskbar.

SingleInstance

Sets or gets a value that indicates whether only one instance of the specified HTML Application (HTA) can run at a time.

SysMenu

Sets or gets a Boolean value that indicates whether a system menu is displayed in the HTML Application (HTA).

Version

Sets or gets the version number of the HTML Application (HTA).

WindowState

Sets or gets the initial size of the HTA window.

You can add JavaScript window properties also

example:
window.resizeTo(500,250);
window.focus();
window.moveTo(400,200);

Lets add some little hta properties and CSS styles, script Then code is modified as below

Note: In order to have icon visible you should put a icon in same directory as application with filename “icon.ico” Now save above code as hta file and see the difference.

You can design very advanced applications if you have Knowledge on following languages HTML, CSS, JavaScript, JSCRIPT, VBSCRIPT, ASP, ASP.NET, WSH and Batch Programming For application to visible as single file you can create SFX archives(Using winrar you can create SFX archives easily)

Leave a Comment