COM Callable Wrapper (CCW)
Dll in .Net and callable in vbscript..
1) CCW.cs
using System;
using System.Runtime.InteropServices;
namespace NMyCCW
{
[ClassInterface(ClassInterfaceType.AutoDual)]
public class ClsCOMServer
{
private string m_strName;
public ClsCOMServer(){}
public void SetName(string strName){m_strName = strName;}
public string GetName(){return m_strName ;}
}
}
2) csc /target:library CCW.cs --- Make a dll
3) regasm ccw.dll /tlb:ccwtlb.tlb /codebase --- Create a tlb.
4) use tlb in vbs---
Dim dotNetObj
Set dotNetObj = CreateObject("NMyCCW.ClsCOMServer")
dotNetObj.SetName ("Subodh")
MsgBox "Name is " & dotNetObj.GetName()
run as --- wscript comclient.vbs

0 Comments:
Post a Comment
<< Home