????PB9?????? PB9???????汾?????????VS.Net?????????Net FrameWork?μ?????????????????COM??PB???????????á?
??????????????????C#?????????COM?????????裺
????1.?????????????
????2.??????????using System.Runtime.InteropServices??
????3.????????????????????PB?????
????4.??????????
????5.????snk???:
????sn -k test2.snk
????6.??cs????????dll???:
????csc /t:library /keyfile:test2.snk /out:test2.dll test2.cs
?????????????????????ò?????System?μ??????:Microsoft.VisialBasic.dll????????????:
????csc /t:library /keyfile:test2.snk /out:test2.dll /r:Microsoft.VisualBasic.dll test2.cs
????7.???COM----------???????????:
????regasm test2.dll /tlb:test2.tlb /codebase
????C#????????????????:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace test2
{
public class test2
{
public int ShowMsg(out int a1??out string a2)
{
a1 = 200;
a2 = "message";
return 100;
}
}
}
????PB????????????:
OLEObject test2
long ll_status
integer li_return
long ll_a1
string ls_a2
//????OLEObject????
test2 = Create OLEObject
ll_status= test2.ConnectToNewObject("test2.test2")
if ll_status=0 then
//????????????????
li_return = test2.ShowMsg(ref ll_a1??ref ls_a2)
messagebox(string(ll_a1)+" "+ls_a2??string(li_return))
end if
//??????
test2.DisConnectObject()