首页 > 代码库 > PowerBuilder调用.Net编译好的DLL

PowerBuilder调用.Net编译好的DLL

   [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_statusstring ls_errorinfo, ls_retOLEObject myobjif not isvalid(myobj) then    myobj = CREATE OLEObjectend ifll_status = myobj.connecttonewobject("HelloWorld.MyClass")IF ll_status <> 0 THEN returnmyobj.UserName = ‘张三‘ls_ret = myobj.SayHello("哈哈")Messagebox(‘提示‘,ls_ret)

PowerBuilder调用.Net编译好的DLL