Using HTML as an application GUI or How do you control an application from Javascript?

N

Nou Dadoun

I'm currently developing an application in C++/MFC (Visual Studio 6,
if that makes a difference) and I'd like to avoid the Windows style UI
widgets and dialogs if at all possible.

In fact, what I'd really like to do is use HTML/web pages as the user
interface and invoke my application in the background to do the heavy
lifting. I'm fairly well experienced with web pages and I've written
a fair amount of JavaScript at one time or another (I taught several
undergrad courses using it actually) but I don't know anything about
its capabilities when it comes to interfacing with or controlling
external applications.

I'll likely be running IE on a Windows box (you can put it into full
screen no-toolbar mode) and here's the question: Can I use client-side
javascript to invoke and/or control my application? I know that
normally javascript can't play outside its own sandbox (i.e. no
filesystem access etc.) for security reasons, but I've seen in the MS
JScript documentation that it's possible to use something called
'unsafe' mode. And since it will only be using web pages on the local
file system, I'm comfortable with that.

Does anyone have experience with this? Do I have to expose hooks to
the app with COM or ActiveX or anything? (something I've used but
haven't directly written before so it's possible). Am I crazy? Is
there a better way to do this?

I'd appreciate any advice or pointers, thanks ... N

Nou Dadoun
 
M

McKirahan

Nou Dadoun said:
I'm currently developing an application in C++/MFC (Visual Studio 6,
if that makes a difference) and I'd like to avoid the Windows style UI
widgets and dialogs if at all possible.

In fact, what I'd really like to do is use HTML/web pages as the user
interface and invoke my application in the background to do the heavy
lifting. I'm fairly well experienced with web pages and I've written
a fair amount of JavaScript at one time or another (I taught several
undergrad courses using it actually) but I don't know anything about
its capabilities when it comes to interfacing with or controlling
external applications.

I'll likely be running IE on a Windows box (you can put it into full
screen no-toolbar mode) and here's the question: Can I use client-side
javascript to invoke and/or control my application? I know that
normally javascript can't play outside its own sandbox (i.e. no
filesystem access etc.) for security reasons, but I've seen in the MS
JScript documentation that it's possible to use something called
'unsafe' mode. And since it will only be using web pages on the local
file system, I'm comfortable with that.

Does anyone have experience with this? Do I have to expose hooks to
the app with COM or ActiveX or anything? (something I've used but
haven't directly written before so it's possible). Am I crazy? Is
there a better way to do this?

I'd appreciate any advice or pointers, thanks ... N

Nou Dadoun

Look into HTA (HTML Applications)!

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/hta/overv
iew/htaoverview.asp

Can you be more specific about your application?
 
J

Jim Ley

I'll likely be running IE on a Windows box (you can put it into full
screen no-toolbar mode) and here's the question: Can I use client-side
javascript to invoke and/or control my application?

Does anyone have experience with this? Do I have to expose hooks to
the app with COM or ActiveX or anything? (something I've used but
haven't directly written before so it's possible). Am I crazy? Is
there a better way to do this?

Yeah, it's easy and common, HTA's have been mentioned, personally I
like Zeepe from http://www.meadroid.com/ for doing this, you get a
lot more than HTA's give you in a nicer package.

Jim.
 
N

Nou Dadoun

McKirahan said:
Look into HTA (HTML Applications)!

http://msdn.microsoft.com/library/default.asp?url=/workshop/author/hta/overv
iew/htaoverview.asp

Can you be more specific about your application?


Thanks for the pointers to HTA (to Robert as well), that's a
technology that I'd never tripped over before. Rename a web page and
get an application, who'd a thunk it?

A few questions though, it looks like a good prototyping tool for
doing quick and dirty UI mockups but I don't see immediately (I'm
still looking, of course) how it might be used as a real application
interface for an existing application. i.e. is there any 'exposed'
object model (that is, exposed to external apps)? Is there a file i/o
mechanism, I'm not familiar with one in client-side javascript and I
don't see an immediate connection to server-side js (which I've never
used admittedly)? Are there other hooks or pointers that aren't
immediately obvious? Does anyone have any actual experience using
HTAs? Caveats? Mudholes?

I can't go into a lot of detail about my app but it's actually two
entirely separate applications, an image acquisition app which
controls some USB cameras and writes images to disc and an image
analysis app which does some processing and reporting on the saved
images. The two currently communicate using the image files and a DDE
mechanism (based on legacy code in the analysis app) to trigger the
analysis but are otherwise entirely separate.

Part of my goal in having an html front end is to use it to do some of
the integration, i.e. ditch the DDE, have the front end trigger the
acquisition/storage and subsequently the analysis under user control.
But if retaining the DDE is simpler for a quick implementation, that's
ok too (for the time being).

Thanks again for any pointers ... N

PS. Running an Apache server on a windows box for an app UI running
on the same machine seems like a lot of overhead (there are some
performance issues with the applications already) but if there's a
serious case to be made for going that route (cgi? server-side js?)
for a working prototype, I'm certainly open to hearing it, thanks ...
N
 
M

McKirahan

[snip]
A few questions though, it looks like a good prototyping tool for
doing quick and dirty UI mockups but I don't see immediately (I'm
still looking, of course) how it might be used as a real application
interface for an existing application. i.e. is there any 'exposed'
object model (that is, exposed to external apps)? Is there a file i/o
mechanism, I'm not familiar with one in client-side javascript and I
don't see an immediate connection to server-side js (which I've never
used admittedly)? Are there other hooks or pointers that aren't
immediately obvious? Does anyone have any actual experience using
HTAs? Caveats? Mudholes?

I can't go into a lot of detail about my app but it's actually two
entirely separate applications, an image acquisition app which
controls some USB cameras and writes images to disc and an image
analysis app which does some processing and reporting on the saved
images. The two currently communicate using the image files and a DDE
mechanism (based on legacy code in the analysis app) to trigger the
analysis but are otherwise entirely separate.

Part of my goal in having an html front end is to use it to do some of
the integration, i.e. ditch the DDE, have the front end trigger the
acquisition/storage and subsequently the analysis under user control.
But if retaining the DDE is simpler for a quick implementation, that's
ok too (for the time being).

Thanks again for any pointers ... N

[snip]

I use HTAs to read files and databases, execute commands (like FTP), and
much more.

I primarily use VBScript to write them.

Take a look at http://www.interclasse.com/scripts/htanotepad.php

A notepad made in HTA

This notepad can handle bigger files than the one shiped with Win9x.
Learn how to make windows looking interfaces in HTML.

A Google search on "HTML Application" will get you started.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top