Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Resize and position HTA window before loading

1,967 views
Skip to first unread message

mickb...@gmail.com

unread,
Sep 4, 2006, 1:51:20 AM9/4/06
to
Hello,

I have a HTA that is set as the logon script for my domain. The first
thing the HTA does is resize and position its window (this is done as
part of the body onload event). When the HTA runs, a large, blank,
white window quickly flashes up before its resized.

Is there a way to set the initial size and position of the HTA before
it is rendered to avoid the messy flashing big window?

Thanks for any help.

Mick.

Sofia Engvall

unread,
Sep 4, 2006, 9:03:41 AM9/4/06
to
Hi Mick! :)

I run a normal vbs as the logon script. This then I use IE for output. This
way you can control the looks of it all better and if the user closes the ie
window it doesn't matter. You can just open it agan. :)

If you get input from the user through your hta this might not work...

Below are some of the my "functions".

Hope this helps! :)

/Sofia

------------------------------------------------------------------------------------------------------------------------
Dim objIE : Set objIE = CreateObject("InternetExplorer.Application")

Function IEOpen() '2005-01-14, 2005-01-24
objIE.Navigate "about:blank"
objIE.StatusBar = 0 : objIE.ToolBar = 0
objIE.Fullscreen = 1 : objIE.Visible = 1
objIE.Document.Title = "Logon Script"
objIE.Document.Body.Style.Backgroundcolor = "#111111"
'objIE.Document.Body.Style.BackgroundImage = ""
objIE.Document.Body.Text = "#DDDDDD"
objIE.Document.Body.Style.Font = "12pt 'Verdana'"
objIE.Document.Body.Style.BorderWidth = "10px"
objIE.Document.Body.Scroll = "Auto"
End Function

Function IEActivate() '2005-01-24
On Error Resume Next 'Disable Error handling in case the IE window was
already closed
SYS_objShell.AppActivate "Logon Script"
On Error Goto 0
End Function

Function IEClose() '2005-01-14, 2005-01-24
On Error Resume Next 'Disable Error handling in case the IE window was
already closed
objIE.Quit
On Error Goto 0
End Function

Function Font(intSize,strColor) '2005-01-17, 2005-01-24
If Len(strColor)<>7 Then strColor = "#DDDDDD"
WriteStd("</FONT><FONT size="+CStr(intSize)+" color="+strColor+">")
End Function

Function WriteStd(strMessage) '2005-01-17, 2005-01-24, 2005-02-07
strOutStd = strOutStd + strMessage
On Error Resume Next 'Disable Errorhandling in case the IE window was
already closed
objIE.Document.Body.InnerHTML = strOutStd
If Err.Number <> 0 Then 'If the user has closed the IE Window, open it
again.
Set objIE = CreateObject("InternetExplorer.Application")
IEOpen()
IEActivate()
objIE.Document.Body.InnerHTML = strOutStd
End If
On Error Goto 0
End Function

'Text is overwritten next time text is added
Function WriteStdTemp(strMessage) '2005-01-17
On Error Resume Next 'Disable Errorhandling in case the IE window was
already closed
objIE.Document.Body.InnerHTML = objIE.Document.Body.InnerHTML + strMessage
If Err.Number <> 0 Then 'If the user has closed the IE Window, open it
again.
Set objIE = CreateObject("InternetExplorer.Application")
IEOpen()
IEActivate()
objIE.Document.Body.InnerHTML = strOutStd + strMessage
End If
On Error Goto 0
End Function
------------------------------------------------------------------------------------------------------------------------

<mickb...@gmail.com> wrote in message
news:1157349079....@p79g2000cwp.googlegroups.com...

Joe Fawcett

unread,
Sep 4, 2006, 9:45:10 AM9/4/06
to
Where do you put the code, if you have it execute automatically at the start
of the document then it should work.
I have tried this but not with a logon script, just a normal HTA.


--

Joe Fawcett (MVP)

http://joe.fawcett.name

<mickb...@gmail.com> wrote in message
news:1157349079....@p79g2000cwp.googlegroups.com...

DhamAngry

unread,
Sep 4, 2006, 4:29:02 PM9/4/06
to
I don't think those who had responded thus far fully understand what you're
referring to. I've created a handful HTAs
(http://www.geocities.com/dhamangry/hta) and control their size in the onLoad
event as well. It seems that the default size and color render before the
re-size takes places. Unfortunately I don't have an answer and have just
looked past this occurrence. Hopefully someone can, if there is a way to
control that behavior, share it here.

mickb...@gmail.com

unread,
Sep 4, 2006, 6:53:45 PM9/4/06
to
Sofia - Unfortunately I can't use IE, it is prevented from loading by
policy.

Joe - I have tried the resize code in both the window and body onLoad
events but the problem persists.

DhamAngry - Hopefully someone will reply with a solution for us!

Joe Fawcett

unread,
Sep 5, 2006, 4:13:51 AM9/5/06
to
I certainly understood, I do it in script before the onload. I will post a
sample later from home.

--

Joe

"DhamAngry" <Dham...@discussions.microsoft.com> wrote in message
news:DDD1582F-3EEE-49EA...@microsoft.com...

Michael Harris (MVP)

unread,
Sep 5, 2006, 11:05:34 PM9/5/06
to

Note the location of the resizing script *above* the hta:application tag.
Positioned here, you won't see the window in it's original default size.

<html>
<head>
<title>My HTA Title</title>
<script language="vbscript">
moveto 250,100
resizeto 500,320
</script>


<hta:application
...
...
/>
...
..
.
</head>

--
Michael Harris
Microsoft MVP Scripting


0 new messages