????? ??????? ????? .NET Visual Basic ?? Visual Basic 2005 ?? Visual Basic 6.0

?????? ????????? ?????? ?????????
???? ???????: 817248 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

????? ???

???? ??? ??????? ????? ??????? Microsoft Visual Basic .NET ?? Microsoft Visual Basic 2005 ???? ????? ????? ???? ???? ????????? ?? Microsoft Visual Basic 6.0.

??????? ????

??????? ????? ????? .NET COM

????? ???? ??? ????? ?? ????? .NET Microsoft ??? ??????? ???? ???? ?????? (COM) ???? ???????? ????????? ??????? ??????? ???????? COM ??????? ?? ??? ???????. ?????? ????? ??????? (???????? ? ????? ? ????? ? ???????) ???? ??? ?? ??????? ???? COM ??? ????? ??? ?????????:
  • ????? ???????? ?????? ????? ????? ???? ???? ?? ????. ???? COM interop ???? ?????? ????? ???? ????? ??? ???? ????? ????? "?" ????? ????? ???????? ?????? ?? ????????. ??? ???? ??? ?????? ????? ?????? ????? ? ????? ???? ????.
  • ???? ?????? ????? ???? ??????? ???? ???? ??? ??? COM ?? ??????. ??? ????? ??????? ?????? ??? ?? ????? ?? ??????? ??? ????? ???. ????? ????? ??? ????? ?????? ??? COM.
  • ?? ?????? ???? ??? ??????? (?????? ? ?????? ???????? ???????) ???? ???? ??? COM ?? ??????. ??? ?? ???? ????? ??????? ?????? ?????? ?????? ??? COM. ?????????? ???? ???? ??????? ?????? ?????? ?????. ??????? ??? ComVisibleAttribute ??? ??? ???? ?????? ????? ?? ??? ?? ???? ???? ??? ?? ??? ?? ???? ???????? ???? COM.
  • ????? ??? ?? ????? ???? ??? ??????? ????? ???? ???? ??????? COM. ? ????? ??????? ?????? ??? COM. ??? ???? ??? ???? ??????? ??? (????? ???? ?????) ? COM ????? ?? ???? ????? ???? ?? ?????. ???? ????????? ???????? ????? COM ????? ??? ?? ????? ???? ????? ?????? ???? ??? ????? ?????? ??? ???? COM. ?? ????? ????????? overloaded ???? ????? ?????? ?????? ???. ??? ???? ???? ??????? ????????? ???? ??????? ??? ?? ??????? ?????? ??? ??????? (.NET).
  • ?? ???? ?? ???? ????? ???????. ?? ??? ?? ?? ????? COM ?? .NET ????? ???? ????? ?????? ????? ?????.
  • ??????? ???? COMClass ?? Visual Basic .NET ?? ?? Visual Basic 2005. ??? ????? ??? ????? ???? ???? ?? ??? ??????? COM ????? ??????? ???? COMClass ???? ??? ?????? ?????? Visual Basic .NET ?? ?????? Visual Basic 2005. ???? ?????? COMClass ??? ???? ????? ??? COMClassAttribute ????? ?????? GUID CLSID "?" ????? ??????? "?" ???? ????? ???? ??? ????? ?????? ??? ????? ??. ???????? ??? ???? ???? ?????? COMClass ???? ??? ???? ??????. ??? ?? ???? ????? ?????? ??? ????? ???? ??? ??????? ??? ????? ????? COM ?????????.

????? ????? .NET ?? COM interop ?????? ????? ???

?????? ??? Visual Basic 6.0 ????? ??????? ?? ???? ????? ??? ????? ??????? interop COM ?????? ????? ???. ??? ????? ??? ??????? ??? ?? ??????? ??? COM ????? ?????? ?????? ?? ???????. ???? ????? ????? ??? ????????? ??? ??????? ???????? ?? ??????? ???????? ???? COM. ????? ????? ??? ??????? ??? ??? ??? ???? ??? ????????? ????? ?? ??? ????????? ??????.

??? ????????? ??????? Microsoft Visual Studio .NET ?? Microsoft Visual Studio 2005 ???????? ?????? ????? ??? ??? ???? ????? ????? ??????? ??? ?? ????? ???? ???????? ????? COM Interop ??? ????? ????? ???????. ??? ??? ?????? ???? COMClass ??? ????? ????? Visual Studio .NET ?? Visual Studio 2005 ???????? ?????? ????? COM Interop ???? ????????. ?????? ?? ??? ?? ????? ???? ???????? ????? Interop COM ?? Visual Studio .NET ?? ?? Visual Studio 2005 ???? ??????? ???????:
  1. ??? ????? Visual Studio .NET ?? Visual Studio 2005.
  2. ??? ???? ???? ????? ??? ??????? ???? ???? ????? interop COM.
  3. ?? ??????? ???? ???? ??? ???? Explorer.
  4. ?? "?????? ??????" ???? ??? ?????? ?????? ??? ??????? ???? ???? ????? interop COM ??? ?? ???? ??? ?????.
  5. ???? ??? ????? ????? ?? ???? ??? ???? ????.

    ?????? ?? Visual Studio 2005 ? ???? ??? ????? ?? ????? ??????.
  6. ???? ?????? ????? COM Interop ???? ????????. ?? ????? ??? ?????? ??? ?? ??? ????? ????????.
  7. ???? ??? ????? ?????? ????? ????? ???? ??????.
??? ?? ??? ????? Visual Studio .NET ?? Visual Studio 2005 ?? ??? ??? ???? ????? ??? ????? (.tlb) ??? ??????? ?????? ?? ????? ??????? ??????? ???? "????? ???????" (RegAsm.exe) ?? / TLB ???????. ??? ????? ??????? ??? ??????? / ??????? ??????? ???????? ??? ??? ??????? ??????? ????? ??? ??? ???? ??? ??????? ???? ??? ??????? ?? ???? ????? ?? ?????? ?????? (EXE).

??? ??? ?? ????? ????? ??? ??? ?????? ????????? ????? ?? ??? ???????. ??? ?????? ????????? ?????? ??????? ?????. ?? ????? ????????? ???? ???? ????? ?? ??? ?????? ??? ?????? ?????? (EXE). ?? ????? ???? COM ? ??? ???? ?? ??????? ??????? ?? ??? ?????? ??? ??? ???????. ????? ????? ????? ????????? ?? ??? ??????? ?????? ??? ?????????. ?????? ????? ????? ??? ????? ??????? ???????? ??? ?????? ?? ????? ??????? ??? ????? ??????? ?????? ??????? ??????? (GAC) ??? ????????? ??????.

?????? ??? ???? ?? ????????? ??? ????? ????? ??????? ???????? ??? ?????? ????? ??????? ??? ????? ??????? ??????? ??????? ??????? (GAC) ?? ?????? ???? Microsoft ?????? ??? ?????:
http://msdn2.microsoft.com/en-us/library/xc31ft41(vs.71).aspx
??? ???? ??????? ?????? / tlb: ??????? ? ?? / ??????? ??????? ???????? ??????? ??? ????? ???????. / tlb: ??????? ???? ????? ????? ??? ?? ??? ??????? / ??????? ??????? ???????? ????? ???? ??????? ???? ??? ??????? ?? ????? Windows. ??? ?? ??? ???? ??????? ??? ??????? / ??????? ??????? ???????? ?? ??? ????? ??????? ??? ????? ??????? ??????? ??????? ??????? (GAC) ? ??? ??? ???? ?? ??????? ?? ?????? ?? ????? ???? COM (EXE) ???? ???? ????? ???? ??????? ?? ???? ??? ????? ????? ?????? (CLR).

????? ????? ????? ??? ???? ??????? ??????? ??????? ? ???? ????? ?????? ?? ???? ???????:
/tlb Regasm AssemblyName.dll: FileName.tlb / ??????? ??????? ????????

????? ????? ????????? COM ?? Visual Basic .NET

  1. ??? ????? Visual Studio .NET ?? Visual Studio 2005.
  2. ?? ??????? ???? ??? ??? ???? ?? ???? ??? ???????.
  3. ??? ????? Project ? ???? ??? ?????? Visual Basic.

    ?????? ?? Visual Studio2005 ???? ??? Visual Basic ??? ????? Project.
  4. ??? ????? ? ???? ??? ??? ?????.
  5. ??? ??????? TestProj ?? ???? ??? ?????.

    ?????????? ??? ????? Class1.
  6. ?? ??????? ???? ???? ??? ???? Explorer.
  7. ???? ??? ?????? ?????? ??? Class1.vb ??? ?? ???? ??? ???. ???? ??? ????? ?????? ????? ????? ?????? Class1.vb.
  8. ?? ??????? ??????? ???? ??? ????? ???.
  9. ??? ????? ? ???? ??? ??? COM.
  10. ??? ??? COMClass1.vb ?? ???? ??? ???

    ??? ????? COMClass1 ???????? ???????? ???????. _
    <ComClass(ComClass1.ClassId, ComClass1.InterfaceId, ComClass1.EventsId)> _
    Public Class ComClass1
    
    #Region "COM GUIDs"
        ' These  GUIDs provide the COM identity for this class 
        ' and its COM interfaces. If you change them, existing 
        ' clients will no longer be able to access the class.
        Public Const ClassId As String = "6DB79AF2-F661-44AC-8458-62B06BFDD9E4"
        Public Const InterfaceId As String = "EDED909C-9271-4670-BA32-109AE917B1D7"
        Public Const EventsId As String = "17C731B8-CE61-4B5F-B114-10F3E46153AC"
    #End Region
    
        ' A creatable COM class must have a Public Sub New() 
        ' without parameters. Otherwise, the class will not be 
        ' registered in the COM registry and cannot be created 
        ' through CreateObject.
        Public Sub New()
            MyBase.New()
        End Sub
    
    End Class
  11. ????? ???? ??????? ??? COMClass1.
       Public Function myFunction() As Integer
          Return 100
       End Function
  12. ?? "?????? ??????" ???? ??? ?????? ?????? ??? Project Name ?? ???? ??? ?????.
  13. ??? ????? ????? ? ???? ??? ?????.
  14. ???? ?? ???? ??????? ?? COM Interop ???? ????? ?? ???? ??? ?????.
  15. ?? ??????? ????? ? ???? ??? ???? ???? ?????? ???????.
  16. ??? ????? Visual Basic 6.0.
  17. ?? ??????? ???? ???? ??? ????? ???? ?? ???? ??? ?????? EXE ????? ?? ???? ?????? ????? ????.

    ?????????? ??? ????? ????? ?????? Form1.
  18. ?? ??????? ??????? ???? "?????".
  19. ?? ????? ??????? ??????? ???? ????? ??????? ?????? TestProj ?? ???? ??? ?????.
  20. ????? ?? ??? ??? ???????.
  21. ???? ????? ??????? ??? Command1 ???? ????????? ???????? ??????.
  22. ?? ?????? ???????? ???????? ??????? ??? ????? Command1_Click.
    Dim myObject As TestProj.COMClass1
    Set myObject = New TestProj.COMClass1
    MsgBox myObject.myFunction
  23. ?? ??????? "?????" ? ???? ??? ???.
  24. ???? ??? ?? ?????.

    ??? ?? ????? ????? ???? 100.

?????

????? ?? ?????????? ?? ?????? ???? Microsoft ?????? ??? ?????:
interoperating ?? ????????? ???????? ??? ????????
http://msdn2.microsoft.com/en-us/library/sd10k43k(vs.71).aspx

???????

???? ???????: 817248 - ????? ??? ??????: 23/?? ??????/1428 - ??????: 6.7
????? ???
  • Microsoft Visual Basic 2005
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft Visual Basic 6.0 Learning Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft .NET Framework 2.0
  • Microsoft .NET Framework 1.1
  • Microsoft .NET Framework 1.0
????? ??????: 
kbmt kbvs2005applies kbvs2005swept kbnamespace kbdll kbcominterop kbinterop kbautomation kbhowtomaster KB817248 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????817248

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com