Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maximize window when html file opened

Status
Not open for further replies.

Gragi

Programmer
Oct 4, 2004
59
US
Hi,
Can anybody post some vbscript code to
automatically windows to be maximized when you load HTML file.

Thank you,
Gragi
 
I found some solution thought might be helpful to somebody else

<script language="JavaScript">
window.moveTo(0,0);
window.resizeTo(screen.width,screen.height);
</script>

Gragi
 
If you're talking about code in the HTML, this should work.
Code:
<script type="text/vbscript">
Sub Window_onLoad
    Window.WindowsState = "maximized"
End Sub
</script>

 
Skie,

I tried the code you have mentioned but I'm getting an error like

An exception of type "Microsoft VBScript runtime error: Object doesn't support this property this property or method: "window.WindowsState" was not handled.

Thanks,
Gragi
 
Sorry, looks like windowstate is read only. This will resize the window so that it looks like it's maximized.
Code:
<script type="text/vbscript">
Sub Window_onLoad
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
    For Each objItem in colItems
        intHorizontal = objItem.ScreenWidth
        intVertical = objItem.ScreenHeight
    Next
    window.moveTo 0,0
    window.resizeTo intHorizontal,intVertical
End Sub
</script>
 
Skie,
Thanks for the placing the code again.

Actually I've fixed mine with little change like Height-30

<script language="JavaScript">
window.moveTo(0,0);
window.resizeTo(screen.width,(screen.height-30));
</script>

Thank You,
Gragi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top