Detecting if there is another HTA active

Batch, ASP, JScript, Kixtart, etc.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 14 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
apagan
Posts: 4
Last visit: Mon Oct 19, 2009 12:44 am

Detecting if there is another HTA active

Post by apagan »

I have a HTA that kicks off another HTA when the user clicks on a button. When the parent HTA is closed, I want to also close out any other HTA kicked off by the parent.
Is it possible to detect what HTA's are running? Or, to close out all child HTAs when the parent is closed?
Any assistance would be appreciated. Thanks.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Detecting if there is another HTA active

Post by jvierra »

The following:
window.showModelessDialog("child.htm")
can just as easily be:
window.showModelessDialog(http://www.google.com)
or any other web location. Web locations will be sandboxed because of where they are loaded from. Any trusted locations will maintain trust. Untrusted will remain untrusted.

User avatar
apagan
Posts: 4
Last visit: Mon Oct 19, 2009 12:44 am

Detecting if there is another HTA active

Post by apagan »

Jvierra, I appreciate the response, the problem with launching the child window that way is that it will not let me focus on the parent window until I close the child. Is there a way around that?
Here is how I initially launched the child:
----------------------------------------------------------------------------------------

strCommand = "%systemroot%system32mshta.exe MyFile.hta" set objShell = CreateObject("Wscript.Shell") set objProc = objShell.Exec(strCommand)
---------------------------------------------------------------------------------------

Thanks!
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Detecting if there is another HTA active

Post by jvierra »

This:

window.showModelessDialog("child.htm")
Will let you focus on either window.

This is modal:
window.showModalDialog "http://www.google.com",,optionsx

Recognize the differences and all will be well.


Using teh shell command will give you no end of headaches.
jvierra2009-10-16 14:07:18
User avatar
apagan
Posts: 4
Last visit: Mon Oct 19, 2009 12:44 am

Detecting if there is another HTA active

Post by apagan »

Got it! I appreciate your assistance.
User avatar
apagan
Posts: 4
Last visit: Mon Oct 19, 2009 12:44 am

Detecting if there is another HTA active

Post by apagan »

Hey, guys, I hate to jump back in with another question, but I am trying to reload the modal window after running a function. The last line inside of the function is a window.location.reload(true), but the window is not reloading. The function runs inside of the modal page. Is there something different that I need to do to reload a modal window?

------------------------- How I load the modal window ----------------------
window.showModalDialog "MyFile.html", "message", "dialogHeight:280px; dialogWidth: 620px; scroll: yes; status: off; resizable: off; center: yes;"
--------------------------------------------------------------------------------------
This topic is 14 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked