DLL and VBScript

  • Thread starter Thread starter The Truth
  • Start date Start date
T

The Truth

All,

I would like to write a DLL with a few function that are not available in
WMI. I know how to write a dll but is there anything special that I must
add to it if I want to be able to you the function from with in it.

Example: In the dll there will be a function call GetMountPoint()

in my VBScript I want to do:
Set oMydll = CreateObject("MyDll")
oMydll.GetMountPoint()

How can I do this.
Thanks in advance.
 
The Truth said:
I would like to write a DLL with a few function that are not available in
WMI. I know how to write a dll but is there anything special that I must
add to it if I want to be able to you the function from with in it.

Example: In the dll there will be a function call GetMountPoint()

in my VBScript I want to do:
Set oMydll = CreateObject("MyDll")
oMydll.GetMountPoint()

Your DLL won't be a garden variety DLL. It will be a DLL which contains a
COM object that implements the IDispatch (Automation) interface. That
interface will contain a method named GetMountPoint().

If the machines on which you plan to run this script have .Net installed
then you may be able to build a .Net component instead and use .Net's RegAsm
utility to register the assembly to be used by COM. It may be that that's
enough COM to satisfy VBScript but I'm not sure about that.

Regards,
Will
 
Could be done within Visual Basic by using the "Declare" function to declare
your dll, and exporting the appropriate function when creating your dll
(using a .def file).

VBScript, however, lacks the Declare statement.

If you want to do it using VBScript alone, you'd need to create a COM
component.

[ eg using File > New > ATL COM Wizard (& then Insert > New ATL Object >
"Simple Object " and then adding methods / properties ((VC++ 6))) ]

Jon
 
Back
Top