C#????COM??PB????
???????????? ???????[ 2013/10/21 10:05:31 ] ????????
????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()
??????

???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11