VB下继承VC接口生成COM组件

前端之家收集整理的这篇文章主要介绍了VB下继承VC接口生成COM组件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

在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
原文链接:https://www.f2er.com/vb/260563.html

猜你在找的VB相关文章