I'm still a little lost too, but: > * I maintain a dll that defines a class that implements I1 and I2. I > use regsvr to register this dll. > * I1 and I2 come from a third party, and in order for my dll to work > properly, it has to implement them (actually I2 is optional). > * I don't know how I1 and I2 are registered.
I don't understand the above. If you maintain the class that implements I1 and I2 how can: * they come from a 3rd party - either you maintain them, or they do? * Surely you know how they are registered? > I do know that if I use > the COM browser, I can go to Registered Type Libraries, find one with > the typelibname that is associated with my CastTo created objects, > which has "Type Library" underneath it, and underneath that are > entries for I1, I2, several related interfaces, and a variety of > coclasses. Like this: > - TypeLibName 1.0 TypeLibrary > -- IID: {00..00} > -- Type Library > --- I1 - Dispatch > --- I2 - Dispatch > --- IX - Dispatch > --- CX - CoClass > > I've just spent some time hunting through the registry to determine > the differences between I1 and I2. What I'm guessing is that the GetTypeInfo() and GetTypeLib() calls for the other dispatch object are failing. Below is how we expect things to work, demonstratrated using for Internet Explorer: >>> from win32com.client import Dispatch >>> d=Dispatch("InternetExplorer.Application") >>> d=d._oleobj_ >>> d.GetTypeInfoCount() 1 >>> d.GetTypeInfo(0) <PyITypeInfo at 0x00D1B038 with obj at 0x0025285C> >>> i=d.GetTypeInfo(0) >>> tlb, index=i.GetContainingTypeLib() >>> tlb.GetLibAttr() (IID('{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}'), 0, 1, 1, 1, 8) >>> Which is the GUID, version, locale etc information (a TLIBATTR structure) for the typelib, and you will find this in the registry. It sounds like this works for one of your objects and fails for the other (well - "fails" might mean that the call works, but returns a GID and version info for a typelib that isn't registered - ie, attempting to load that typelib would fail.) ie, you would also need the following to work: >>> guid, lcid, syskind, majver, minver, flags = tlb.GetLibAttr() >>> import pythoncom >>> pythoncom.LoadRegTypeLib(guid, majver, minver, lcid) <PyITypeLib at 0x00D1B038 with obj at 0x00254530> >>> _.GetDocumentation(1) (u'DWebBrowserEvents', u'Web Browser Control Events (old)', 0, None) >>> Hope this helps, Mark _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32