Forum posts for mshta.exe

mshta.exe process keeps running after closing HTA

I'm developing a HTA app, which shows pdf files in an iframe by dynamically setting src of the iframe.

HTML:

<iframe id='preview' src='' application='yes'></iframe>


The relevant script:

var path = 'some_path/file_name.pdf';
document.getElementById('preview').src = path;


This works well, but when I close the app, I can still see mshta.exe running in Task Manager's Processes tab. If any pdf is never loaded to iframe, the mshta.exe process is terminated properly. There's also no troubles if a .htm file is loaded instead of a .pdf. The problem occurs only, if any of the loaded pdfs is a 3D pdf, which is run by A3DUtility.exe.

Loading a .htm file to iframe in onbeforeunload handler doesn't fix the problem. The only working solution I've found, is to kill A3DUtility.exe process via WMI (the script below). However, it's a bit brutal way to close a program, since I can't be sure if there's other windows running an embedded A3DUtility.exe too.

beforeTopClose = function () {
var pdf,
pdfs = new Enumerator(lib.wmiService.ExecQuery('Select * from Win32_Process Where name = 'A3DUtility.exe''));
while (!pdfs.atEnd()) {
if (pdfs.item().CommandLine.indexOf('-Embedding') > -1) {
pdf = pdfs.item();
}
pdfs.moveNext();
}
if (pdf) {
pdf.Terminate();
}
return;
}


Is there anything I can do to close a 3D pdf within iframe properly before closing the app?

View complete forum thread with replies

Other posts related to mshta.exe

See Related Forum Messages: Follow the Links Below to View Complete Thread

Executing 32bit and 64bit mshta.exe (bypass default handler)
mshta.exe process keeps running after closing HTA
Standalone HTML Application
How to debug IE9 HTA?

What is the carbon footprint of your coffee?

Is it low? Is it high? Can this things really kill the planet Earth? Maybe the answer will surprise you. Maybe not.