Problem Description:

As you know, MSHTA.EXE is used to host .HTA files. If you use the web browser control, or just use IE and navigate to an .hta file, you will get a "Run/Open, Save, Cancel" confirmation dialog. If you choose Run, MSHTA will load the .hta and so forth.

However, I want to write a host EXE to load our .hta program. Yes, do the same thing as MSHTA.EXE, but I want to be the host instead.


1. Is there any way to do this with the web brower control I suspect no, because I don't see any properties on the object that lead me to believe otherwise.

2. If not, then sorry I must ask this, but is hosting MSHTML directly the way to host an .hta

If anyone has a link to a .net sample on how to do this, I would be greatful. The internet is flooded with partial samples, none of which I've found talk about .hta hosting.


Re: Internet Explorer Web Development How to host an HTA?

Derek Smyth


If I remember correctly (and if i haven't then sorry) a hta application is just a web page with it's html extension changed to hta. Try renaming the extension back to html and see if it loads in internet explorer, if that works then you can host it.

Re: Internet Explorer Web Development How to host an HTA?


I found some samples on how to host MSHTML directly, however it still does not load .hta files.

Yes, if I rename the .hta file to .htm for example, MSHTML renders the HTML in that file, but the browser security model is still enforced and nothing hta related is interpreted.

When the file has an .hta extension and I try to Navigate() to it, I'm back to getting the Run/Open, Save, Cancel dialog and once again MSHTA.EXE program is launched.

Perhaps maybe the question is really, is there a way to tell MSHTML just to disable the browser security model In other words, if I could just do that, I don't care about MSHTML not knowing what an <HTA:APPLICATION> element is and so forth, because my application is already the one with the menus and styles I want, etc.

I see there is a Microsoft.mshtml.dll assembly and it has an HTMLAppBehaviorClass in it, but I'm not sure how to use it, or even if it would help me.