在VB下调用VC写的COM动态库,并生产COM组件。程序很简单,只是当时写的时候因为对VB语言的不熟悉,就弄得很困难。
此处是原帖:http://topic.csdn.net/u/20110313/09/f2b56748-3cf8-4b0d-91cd-ee9035f3c130.html
Public Class Css
Implements laserca.ICAMenu'接口继承
Sub AddMenu(ByRef pMenuIndex As Object, ByRef pName As String) Implements laserca.ICAMenu.AddMenu
Dim myArray() As Short = {1, 2}
pMenuIndex = myArray
pName = "ss"
End Sub
Sub doFunction(ByVal para As Object) Implements laserca.ICAMenu.doFunction
End Sub
End Class
然后打开VS2005命令提示符
注册
regasm /tlb [filename] /codebase
注销
regasm /u [filename]
Public Class Css
Implements tlbToDll.ICAMenuUnit'接口继承
Sub getMenuPara(ByRef pMenuIndex As Object, ByRef pName As String) Implements tlbToDll.ICAMenuUnit.getMenuPara
Dim myArray() As Short = {0, 2}
pMenuIndex = myArray
pName = "ss"
End Sub
Sub doFunction(ByVal pWorker As Object) Implements tlbToDll.ICAMenuUnit.doFunction
MsgBox(" Hello World!")
End Sub
End Class