Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - DLL typelibs and VBScript

Reply
 
Old 09-25-2008   #1 (permalink)
axtens


 
 

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
Old 09-25-2008   #2 (permalink)
mr_unreliable


 
 

Re: DLL typelibs and VBScript



axtens wrote:
Quote:

> 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
Old 09-25-2008   #3 (permalink)
expvb


 
 

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
Old 09-25-2008   #4 (permalink)
Mark Pryor


 
 

Re: DLL typelibs and VBScript

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

> 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
Reply

Thread Tools


Similar Threads
Thread Forum
New to VBscript, Help please! VB Script
CSS and VBscript VB Script
Where is VBscript now? VB Script
How to do No hang up VBScript (nohup for VBScript) VB Script
vbscript and HTA help VB Script


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46