...

View Full Version : Dynamically loaded HTA



Basscyst
11-24-2004, 12:15 AM
I've found that HTA seems to suit my needs for a project I am working on, I thought that an HTA file acts similarly to an EXE. What I'm trying to do is launch an HTA front end to an access database, when the DB is executed. When I was using html extensions, I was able to create my HTML and JS files on the local file system (The code is all in the DB) launch IE and load up the freshly created files. Now that there is an HTA extension I thought I might be able to just launch the HTA directly, but to no avail. Now I get a do you want to download or open prompt. Which honestly is worse than the active X prompt I was getting before. Is there a way to load up \ execute an HTA dynamically in VB for applications, without a prompt?

This is what I have when it is an html file:


stAppName = "C:\Program Files\Internet Explorer\IEXPLORE.EXE file:\\C:\Documents and Settings\" & Environ$("USERNAME") & "\Local Settings\Application Data\BMS\main.hta"
Call Shell(stAppName, 1)


and when I switched to hta I thought I'd try:



stAppName = "C:\Documents and Settings\" & Environ$("USERNAME") & "\Local Settings\Application Data\BMS\main.hta"
Call Shell(stAppName, 1)


The top one will load the hta, but only after the prompt to save or open, while the bottom does nothing.

Ah Hah, I think I figured it out, somewhat. It doesn't open with IE by default, it opens with Microsoft (R) HTML application host. In which case can I shell execute that in lieu of IE and specify the file just as above? If so, where is it?

Basscyst

codegoboom
11-24-2004, 01:00 AM
It should be in the system root directory, so an absolute path would not need to be supplied, but anyway, if you shellExecute() the .hta file, it should open with its default app...

Basscyst
11-24-2004, 01:09 AM
That's what I would think too (just shell exec the hta), it just sits there though.

I got it to work, by doing this:



stAppName = "mshta.exe file:\\C:\Documents%20and%20Settings\axmathe\Desktop\Copy%20of%20ERS\bms.hta"
Call Shell(stAppName, 1)


Excellent!! Thanks again for your help with this CGB! :thumbsup:

Basscyst

codegoboom
11-24-2004, 01:52 AM
Ah, shellExecute is a method that can only be invoked from script, according to the ref... now that I check. ;)

scroots
11-24-2004, 10:08 PM
i have a post about HTA's and MS access databases, as i used it for a college project.

http://www.codingforums.com/showthread.php?t=31730&highlight=scroots

If you need any help i have all my code from my project last year.

scroots

Basscyst
12-01-2004, 12:08 AM
Yep, that's the code that got me started with the db driven version, I was using text files before. Thanks a million, I use it every day. Took me a year to put 2 and 2 together and realize what an hta was though. I'd been using it through IE and an HTML extension. :o

Basscyst

scroots
12-01-2004, 07:33 PM
I'm glad someone other than myself had a use for it.

It makes me happy, that i have produced something that is useful to others out of an almost meaningless project.

I found <div></div> Helpful as you can run a function, query, and return the results without a refresh.

scroots

Basscyst
12-01-2004, 09:46 PM
Yep exactly, I have gotten deep with it in the past year, my current project is reaching about 4000 lines of javascript. :eek: Great fun, and I worked around all our IT departments limitations for servers, and type of files that can be stored and where they are stored on our network. :thumbsup:

Basscyst



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum