2
votes

In my HTA, I hold it it open if an error occurred, and close it if everything was successful. At the start, I have the sysmenu property set to no because I do not want the user to close the HTA until it's finished. At the end, I want them to be able to click on the close button. Here's what I typed up to try to achieve this, but it doesn't seem to work? I suspect there is something I need to do to get the HTA to refresh it's windows properties?

Please note that any solution that completely reloads the window and/or makes the script execute again is not acceptable

If Not bHoldOpen Then
    Call window.close
Else
    Dim tagHTA
    Set tagHTA = document.getElementsByTagName("hta:application").item(0)
    Call tagHTA.setAttribute("sysmenu","yes")
End If
1

1 Answers

2
votes

You cannot change it at runtime, its only available in the HTA: block as its value is used to determine how the physical window is to be initially created.

I thought you could produce a warning using the onBeforeUnload event & call cancelBubble to abort the close, but I tried it in IE8 and it still seems bugged; http://support.microsoft.com/kb/946214.

It would probably be simpler and easier for the user to comprehend if you were yo just unhide a "Close" button when the process completed.