Using DLLs in VBScript

后端 未结 3 564
悲&欢浪女
悲&欢浪女 2020-12-08 06:04

I\'ve compiled C# code into a DLL, but have little experience with them. My C# code contains a class HelloWorld with a static method Print(). I\'d

相关标签:
3条回答
  • 2020-12-08 06:14

    I think you might be looking for Registration-Free COM. This SO answer regarding the Microsoft.Windows.ActCtx should help specifically for VBScript.

    Keep in mind that COM doesn't support static methods, so you'll have to make your Print method into an instance method.

    0 讨论(0)
  • 2020-12-08 06:15

    How to call a .NET DLL from a VBScript

    0 讨论(0)
  • 2020-12-08 06:24

    If your dll is registered with the system, use CreateObject with it's ProgID.

    Set myObject = CreateObject("MyReallyCoolObject.HelloWorld")
    myObject.Print
    

    If your object is not registered on the system, use GetObject with a path to the file containing your object. Make sure your object exposes the proper interface. (The second parameter is optional. Here you can provide a class name if your object exposes more than one.)

    Set myObject = GetObject("C:\some\path\helloworld.dll", "appname.HelloWorld")
    myObject.Print
    
    0 讨论(0)
提交回复
热议问题