Search code examples
c#.netcomvb6dcom

Is using COM right for me?


My work has an application written in VB6. I am tasked with writing another, different, application in C# .NET. I am not allowed to change the VB6 code, but I need to call a function (from my .NET application) every time a particular function gets called in the VB6 application.

My boss recommended using COM or DCOM for this task. I am not familiar with either of these topics, and am having trouble finding a tutorial that I can understand easily and that relates to my task.

Can I do this using COM or will I have to modify the existing VB6 code?


Solution

  • You need to expose the function in VB6 as COM (ActiveX DLL). This is straight forward. http://vb-helper.com/howto_activex_dll.html

    Calling a COM Object is easy too. http://www.c-sharpcorner.com/UploadFile/psingh/CallingCOMComponentFromCSharp12022005231615PM/CallingCOMComponentFromCSharp.aspx