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.
William DePalo [MVP VC++] - 23 Jul 2004 04:32 GMT
> 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
[quoted text clipped - 5 lines]
> 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
Jon - 23 Jul 2004 11:55 GMT
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
> All,
>
[quoted text clipped - 10 lines]
> How can I do this.
> Thanks in advance.