Sample code from COM Interop Exposed - Part 2

Someone emailed me with a request for sample code from my second COM Interop Exposed article on 15seconds.com. Since they didn't leave an email address where I could send them the ZIP file, I just decided to post it here:

COMInterop2.zip

2 Comments

  • The method outlined in this artical no longer works with Visual Studio 2005.



    You have to go into the project properties, application - assembly information and check

    'Make Assembly COM-Visible'



    For a VB.net project add this at the top of your class



    <ComClass(Designer.ClassId, Designer.InterfaceId, Designer.EventsId)> _



    and this inside your class



    #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 = "10e1d4f7-630e-4215-a059-c7016ab39a9d"

    Public Const InterfaceId As String = "ac9a6517-dbfa-477b-9d27-141ab7a191fd"

    Public Const EventsId As String = "2d990c38-3b8e-4a80-9414-a7423597cab8"

    #End Region



    all events should now be com visible



  • obviously changing the guid strings using guidgen or a similar program.



    Alternatively use the 'com class' template that comes with vs2005 to generate the guid's.

Comments have been disabled for this content.