c# - Using ComTypes.ITypeInfo.CreateInstance object's information to expose interfaces within a coclass -
i'm working unmanaged type libraries , reference files in c# (.net) application information out of them, such interfaces, functions, enums, etc, contain. have object of type comtypes.itypeinfo represents coclass. i've written code coclass's name, want list of names of interfaces contained within coclass. couldn't find "easy-access" properties in system.runtime.interopservices.comtypes namespace, meet end, i'm using itypeinfo.createinstance. understanding, doing can out com object of type object , desired information (i'm beginner @ com feel free point out i'm incorrect).
i can way i've made call on coclass , got out object of type "object {system.__comobject}", i'm not sure go there. how can use coclass com object obtain names of interfaces contains? here's code i'm using coclass com object:
//assume ti object below initialized object of typekind.tkind_coclass comtypes.itypeinfo ti; if(//condition know ti coclass) { try { int href; object obj; (var = 0; < titypeattr.cimpltypes; i++) { ti.getreftypeofimpltype(i, out href); comtypes.itypeinfo newti; ti.getreftypeinfo(href, out newti); if (newti != null) { intptr attrp; comtypes.typeattr attr; newti.gettypeattr(out attrp); attr = (comtypes.typeattr)marshal.ptrtostructure(attrp, typeof(comtypes.typeattr)); if (attr.typekind == comtypes.typekind.tkind_interface || attr.typekind == comtypes.typekind.tkind_dispatch) { guid iid = attr.guid; ti.createinstance(null, iid, out obj); //stuck here: stuff obj acquire interface names within newti.releasetypeattr(attrp); } } } } catch(exception e) {console.writeline(e);} }
is there way use object obj info i'm looking for? or there easier way/a way @ all? thank you!
Comments
Post a Comment