HTA and XP SP2

J

Jim de Graff

My laptop is running XP SP1. My desktop is running XP SP2. I have a sample
hta that I wrote for the benefit of otheres here who needed a template. This
HTA pops up another IE window and uses it to display a progress bar. It
works fine on the laptop but when I run it on the desktop I get "To help
protect your security, Internet Explorer has restricted this site from
showing certain content...." How do I disable this "feature" and allow my
scripts to run as they do under SP1?

Here is the script

<html>
<!--
'
'
' Name:
'
'
'
' Demo2.hta
'
'
'
' Description:
'
'
'
' This is a demo hta script which shows how to display a progress window
during a '
' lengthy process.
'
'
'
' Audit:
'
'
'
' 2004-04-22 jdeg original code
'
'
'
-->
<title>Demo HTA</title>

<HTA:APPLICATION
ID="myHTA"
APPLICATIONNAME="demo2"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
<head>

<style>
BODY
{
background-color: buttonface;
font-family: Helvetica;
font-size: 8pt;
margin-top: 10px;
margin-left: 10px;
margin-right: 10px;
margin-bottom: 10px;
}

..button
{
font-family: Helvetica;
font-size: 8pt;
width: 35px;
}

textarea
{
font-family: arial;
font-size: 8pt;
margin-left: 3px;
}

select
{
font-family: arial;
font-size: 8pt;
width: 450px;
margin-left: 0px;
}

</style>

<script language="vbscript">

Sub Window_Onload

alert "when you click OK, the main window will shrink and the progress
window will be displayed"

Self.ResizeTo 1,1

ShowProgress

alert "when you click OK, the progress meter will start running"

for i = 1 to 100
UpdateProgress i,100
Dialog.Progress.innerHtml = "pass " & i
for j = 1 to 10000
next
next

alert "when you click OK, the progress window will close and the main
window will redisplay"

HideProgress

self.Focus()
self.ResizeTo 200,100

End Sub

sub btnOpen_onClick

alert "you clicked the Open button"

end sub

sub btnQuit_onClick

alert "you clicked the Quit button"

end sub

dim dialog

sub ShowProgress

Set dialog =
window.Open("about:blank","ProgressWindow","height=15,width=375,left=300,top=300,status=no,titlebar=no,toolbar=no,menubar=no,location=no,scrollbars=no")

dialog.Focus()
dialog.ResizeTo 375,15
dialog.MoveTo 100,200
dialog.document.body.style.fontFamily = "Helvetica"
dialog.document.body.style.fontSize = "10pt"
dialog.document.writeln "<html><body>" _
& "<OBJECT ID=""ProgressBar"" WIDTH=350 HEIGHT=22
CLASSID=""CLSID:8BD21D10-EC42-11CE-9E0D-00AA006002F3"">" _
& " <PARAM NAME=""VariousPropertyBits"" VALUE=""746604571"">" _
& " <PARAM NAME=""ForeColor"" VALUE=""2147483650"">" _
& " <PARAM NAME=""BackColor"" VALUE=""2147483663"">" _
& " <PARAM NAME=""Value"" VALUE="""">" _
& " <PARAM NAME=""FontName"" VALUE=""Wingdings"">" _
& " <PARAM NAME=""FontHeight"" VALUE=""200"">" _
& " <PARAM NAME=""FontCharSet"" VALUE=""2"">" _
& "</OBJECT>" _
& "<div id=""Progress""></div></body></html>"

dialog.document.title = "Please wait."
dialog.document.body.style.backgroundColor = "buttonface"
dialog.document.body.style.borderStyle = "none"
dialog.document.body.style.marginTop = 15

end sub

sub UpdateProgress ( numdone , total )

if total <= 0 then
numblks = 100 \ 3
else
numblks = ((100.0 * numdone) / total) \ 3
end if

dialog.document.ProgressBar.Value = String(numblks,"n")

end sub

sub HideProgress

dialog.Close

end sub

</script>
</head>

<body>

<input id=openbutton class="button" type="button" value="Open"
name="btnOpen">
&nbsp&nbsp
<input id=quitbutton class="button" type="button" value="Quit"
name="btnQuit">

</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top