Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change HTA application window size

Tags:

hta

is there any way to change the size of an HTA application?

thanks

like image 847
Remus Rigo Avatar asked Jul 02 '10 13:07

Remus Rigo


2 Answers

<script type="text/javascript">
    window.resizeTo(300,290);
</script>
like image 99
Piskvor left the building Avatar answered Sep 26 '22 14:09

Piskvor left the building


Javascript and VBScript ways to size the HTA on loading, to 1/4 the screen area (half the height, half the width) and center it - using screen.availWidth and screen.availHeight :

<SCRIPT LANGUAGE="javascript">

function Window_onLoad(){  // resize to quarter of screen area, centered
   window.resizeTo(screen.availWidth/2,screen.availHeight/2);
   window.moveTo(screen.availWidth/4,screen.availHeight/4);
}

window.onload=Window_onLoad;

</SCRIPT>

In VBSScript a Window_onLoad sub will automatically get called any time the HTA starts up (or is refreshed) :

...
</head>

<SCRIPT LANGUAGE="VBScript">

Sub Window_onLoad
    ' resize to quarter of screen area, centered
    window.resizeTo screen.availWidth/2,screen.availHeight/2
    window.moveTo screen.availWidth/4,screen.availHeight/4
End Sub 

</SCRIPT>

<BODY>
...

I've just tested it (Win XP on an old laptop) and there's a quick flicker of the initial larger window before it shrinks to the smaller size, but it's not that bad.

like image 44
AjV Jsy Avatar answered Sep 23 '22 14:09

AjV Jsy