Click here to Skip to main content
15,886,795 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i make this code into dll from visual studio and register it but i cant make a vbs code to use it or even rewrite it in vbs code

VB
Dim hostname As IPHostEntry = Dns.GetHostEntry("www.google.com")
Dim ip As IPAddress() = hostname.AddressList
Debug.Print(ip(0).ToString())
Posted
Updated 24-Nov-15 10:44am
v2

1 solution

This code has to be in a COM-exposed library. You can NOT create a normal class library project and expect it to work in VBScript. It MUST be a COM-exposed library.

Next, the library has to be registered using REGASM, found under C:\Windows\Microsoft.NET folders. REGSVR32 WILL NOT WORK!

After that, in your VBScript coede, you have to create an instance of your class using CreateObject before you can call the methods you exposed in your class code in the library.
 
Share this answer
 
Comments
Member 12164472 24-Nov-15 16:42pm    
i did all of this but i cant make the VBscript code
Dave Kreskowiak 25-Nov-15 13:16pm    
Like I already said, you have to create an instance of the class in your library in order to use it.

Dim objMyClass, result
Set objMyClass = WScript.CreateObject("MyCOMExposedLibrary.MyClass")
result = objMyClass.MyTestMethod(someParameter)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900