Resize HTA Application Window

Is there a way to resize an HTA application?

thanks

+4
source share
4 answers
<script type="text/javascript"> window.resizeTo(300,290); </script> 
+8
source

The capabilities of Javascript and VBScript for determining the size of an HTA at boot up to 1/4 of the screen area (half height, half width) and its center 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 is automatically called at any time when the HTA starts (or updates):

 ... </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 just tested it (Win XP on an old laptop) and there is a quick flicker of the initial larger window before it shrinks to a smaller size, but it's not so bad.

+5
source

Here is a hint. If the HTA needs to be changed or moved when hta is open, then set resizeTo and moveTo to your own script tag immediately after the HEAD tag. Then you will not see a flash that occurs as a result of resizing / moving.

 <HTML> <HEAD> <SCRIPT type="text/vbscript" language="vbscript"> ' Do the window sizing early so user doens't see the window move and resize Window.resizeTo 330, 130 Call CenterWindow Sub CenterWindow() Dim x, y With Window.Screen x = (.AvailWidth - 330 ) \ 2 y = (.AvailHeight - 130 ) \ 2 End With Window.MoveTo x, y End Sub </SCRIPT> .... 
+1
source

Try setting the HTA attribute status window to minimize

 windowstate="minimize" 

your resize procedure will then set the desired size and make the window display.

0
source

Source: https://habr.com/ru/post/1314552/


All Articles