Windows Vista Forums

DLL typelibs and VBScript
  1. #1


    axtens Guest

    DLL typelibs and VBScript

    G'day everyone

    Lately I've been writing typelibs to go with standard DLLs for use
    with VB6.

    I was wondering how feasible it would be to write an ActiveX/COM DLL
    that could be given a typelib at run time and expose the methods and
    properties defined therein to VBScript. Suppose, for example, I have a
    typelib that exposes GMP functionality to VB6. Could an ActiveX/COM
    DLL read that typelib, "register" its methods and properties, and make
    them available to VBScript. Something like this:

    set o = createobject( "BOTLR.TypeLibReader" )
    o.ConnectTo "C:\Typelibs\GMP.TLB" 'which refers to my own DLL with
    GMP statically linked in
    set n1 = o.Eval("new_mpz_t") 'my own code to define and return
    set n2 = o.Eval("new_mpz_t")
    set res = o.Eval("new_mpz_t")
    .... etc

    Possible?

    Kind regards,
    Bruce.



      My System SpecsSystem Spec

  2. #2


    mr_unreliable Guest

    Re: DLL typelibs and VBScript



    axtens wrote:

    > I was wondering how feasible it would be to write an ActiveX/COM DLL
    > that could be given a typelib at run time and expose the methods and
    > properties defined therein to VBScript.
    >
    G'Day Mate,

    Well yes, in two steps.

    For one, if you use CreateObject (either one), then all the
    methods and properties will be available to your script --
    at least all the PUBLIC methods and properties.

    That leaves the constants (enumerated and otherwise). You
    can access them it you write your script as a "wsf" (xml)
    file, and then use a "reference" tag. The "reference" tag
    reads through the typelib and makes the constants available
    to your script as if you had declared them all.

    cheers, jw
    ____________________________________________________________

    You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
    the answers will be applicable to the questions)

      My System SpecsSystem Spec

  3. #3


    expvb Guest

    Re: DLL typelibs and VBScript

    First, check this VB6 calculator which can utilize unlimited digits(source
    code is included):

    http://www.karenware.com/powertools/ptcalc.asp

    Second, the tool that you want can be made with C++. VB6 cannot arbitrarily
    call any function that it's name is determined at run time. There are third
    party tools that allows you to embed assembly in VB6 code, but I didn't try
    them. Regardless of which, it's more difficult to make a generic caller or
    gateway than making a DLL to support the functionality that you want.

    Finally, check "Type Library Reader / Object Browser" below. The first link
    is for VB6, the second one for VBScript:

    http://www.jsware.net/jsware/vbcode.php5#tlbc
    http://www.jsware.net/jsware/scripts.php5#obbro




      My System SpecsSystem Spec

  4. #4


    Mark Pryor Guest

    Re: DLL typelibs and VBScript

    On Thu, 25 Sep 2008 10:02:18 -0700, axtens wrote:

    > G'day everyone
    >
    > Lately I've been writing typelibs to go with standard DLLs for use with
    > VB6.
    >
    > I was wondering how feasible it would be to write an ActiveX/COM DLL
    > that could be given a typelib at run time and expose the methods and
    > properties defined therein to VBScript. Suppose, for example, I have a
    > typelib that exposes GMP functionality to VB6. Could an ActiveX/COM DLL
    > read that typelib, "register" its methods and properties, and make them
    > available to VBScript.
    Hey Bruce,

    This is what Bruce McKinney did, with his book still online

    http://brucem.mystarband.net/mckinney2a.htm#19

    at that URL you can find his WinTLB typelib, which has declares for many
    of the core Windows standard DLL's.

    Using a typelib saves you the trouble of writing the declares, but you
    will still have to write an ActiveX DLL that groups the methods and
    constants from the typelib into classes and properties, via some object
    model.

    There are many examples out there where windows DLL's are treated this
    way with VB6 ActiveX.

    --
    Mark

      My System SpecsSystem Spec

DLL typelibs and VBScript problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
are VBscript on Windows server 2003 and VBscript on WS2008 compatible? Francois Lafont VB Script 9 26 Apr 2010
Can a vbscript identify the program/process that called a vbscript MarceepooNu VB Script 15 16 Mar 2010
CSS and VBscript RICK VB Script 1 23 Jan 2009
How to do No hang up VBScript (nohup for VBScript) gimme_this_gimme_that VB Script 3 28 Oct 2008
vbscript and HTA help Daz VB Script 10 31 May 2008