标签:
[ComVisible(true)] [ClassInterface(ClassInterfaceType.AutoDual)] [ProgId("HelloWorld.MyClass")] //类名 public class MyClass { public string UserName { get; set; } //对外提供属性 public string SayHello(string content) //对外提供方法 { return "用户:" + this.UserName + "说:" + content; } }
类库发布设置
PB调用代码:
long ll_status string ls_errorinfo, ls_ret OLEObject myobj if not isvalid(myobj) then myobj = CREATE OLEObject end if ll_status = myobj.connecttonewobject("HelloWorld.MyClass") IF ll_status <> 0 THEN return myobj.UserName = ‘张三‘ ls_ret = myobj.SayHello("哈哈") Messagebox(‘提示‘,ls_ret)
标签:
原文地址:http://www.cnblogs.com/villison/p/4190729.html