Re: WebBrowser Control (VB5, VB6) & window.external. Possible?
- From: "Larry Serflaten" <serflaten@xxxxxxxxxxxxxx>
- Date: Thu, 24 Jul 2008 22:20:02 -0500
"ClarkVent" <ClarkVent@xxxxxxxxxxx> wrote
All this information is available to the VB application, but not to the
WebBrowser Control. So I want the page to be able to "ask" the hosting
VB app for this information. For instance like this:
<SCRIPT Language=JavaScript>
function getInformation() {
computerName = window.external.getComputerName();
freeSpace = window.external.getFreeDiskSpace();
importantData = window.external.getDataFromDevice();
// Do whatever I want to do with this data
}
<SCRIPT>
These three functions (getComputerName(), getFreeDiskSpace() and
getData()) should all be functions in the VB app.
But a bigger issue is the script code that knows what functions would be
available. The only pages that could utilize that information are pages that
you've hand crafted yourself, or are otherwise targeted for display in your
VB application.
Secondary to that is knowing when your script is going to run. In essence
it will be called in response to some event (even if its the OnLoad event or
similar) which is why I suggested a method to respond to specific events.
In any case, your setting up a hardwired situation where either your VB
app has to know something about the webpage objects, or your webpage
code has to know something about the hosting application. I'd guess its
a tossup which way you want to handle that, but it just doesn't 'feel' like
a good design from the start. It is too rigid, and would be difficult to
maintain or enhance.
If I had to do something similar, I would attack it in a different fashion.
In your case, a desire for current / dynamic information, I'd create
hidden (text) objects on the webpage that could be populated from the
VB application.
They'd have to follow a rigid naming convention, but that's not a
show stopper. In any case raising an event to the VB app could cause
it to look for specifically named objects on the page and populate them
with their associated data. The script code could then raise the event,
and gather the information from the page objects. The page only need
include objects for which it has a need, and the VB app can simply skip
over any names it does not recognise.
There are other methods that could be possible (ex: an embedded AX
object) but I would advise that the less each has to know about the other
the easier it will be to maintain and enhance.
LFS
.
- References:
- WebBrowser Control (VB5, VB6) & window.external. Possible?
- From: ClarkVent
- Re: WebBrowser Control (VB5, VB6) & window.external. Possible?
- From: mayayana
- Re: WebBrowser Control (VB5, VB6) & window.external. Possible?
- From: ClarkVent
- Re: WebBrowser Control (VB5, VB6) & window.external. Possible?
- From: DanS
- Re: WebBrowser Control (VB5, VB6) & window.external. Possible?
- From: ClarkVent
- Re: WebBrowser Control (VB5, VB6) & window.external. Possible?
- From: mayayana
- Re: WebBrowser Control (VB5, VB6) & window.external. Possible?
- From: ClarkVent
- WebBrowser Control (VB5, VB6) & window.external. Possible?
- Prev by Date: Re: WebBrowser Control (VB5, VB6) & window.external. Possible?
- Next by Date: Re: How to detect unicode text?
- Previous by thread: Re: WebBrowser Control (VB5, VB6) & window.external. Possible?
- Next by thread: Re: WebBrowser Control (VB5, VB6) & window.external. Possible?
- Index(es):
Relevant Pages
|