Managed COM server and COM client. How to subscribe to events of COM server?
hello wrote managed com server , com client in c#. when i’m trying reference com server in com client using code. type comtype = type.gettypefromprogid("my.comserver", true); object comobj = activator.createinstance(comtype); var comserver = (comserver)comobj; i reference new object instead of reference registered com server in rot. fix problem, use pinvoke cogetclassobject it works have problem. private void initcomserver(object sender, routedeventargs e) { object comserverinstance = null; var factory = ole32nativemethods.cogetclassobject(typeof(testcoclass).guid, registrationclasscontext.localserver, intptr.zero, typeof(iclassfactory).guid) iclassfactory; if (factory != null) { var iid = typeof(itestinterface).guid; factory.createinstance(null, iid, out comserverinstance); } this.comserver = (itestinterface)comserverinstance; } i don’t know ...