Re: WebBrowser Control (VB5, VB6) & window.external. Possible?




"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




.



Relevant Pages

  • Re: Creating Secure Standalone Binaries for 9/X
    ... I can't figure out how to lock down the app ... so the IP of the script is unprotected. ... does is copy the text of your script into the resource: ... Of course, as Andreas said, it's probably just a matter that the file type ...
    (comp.lang.tcl)
  • Re: Java at startup
    ... You also sent me something stating that "When you restart the app it ... I originally had this script run from the ... >> Dave Stewart ...
    (AIX-L)
  • Re: Checking for running process
    ... > I've created a simple WSH script for the Win2000 computers in my kid's ... classroom that attempts to solve the problem of the kids launching multiple ... get impatient and click multiple times and launch the app a bunch of times. ... its own PID. ...
    (microsoft.public.scripting.wsh)
  • Re: why write a script when u can write a vb6 app
    ... >> Ofcourse writing a script is easier and faster, ... Because I have to assume that only I will modify a VB app, ... With a script, I ... VBScript can deal with byte arrays, but cannot declare or modify them. ...
    (microsoft.public.scripting.vbscript)
  • Re: Newbie php problem
    ... Please forget the first part of the script, as I do put some extra ... accepting input, ... Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers ...
    (alt.php)