Click here to Skip to main content
13,152,454 members (37,048 online)
Rate this:
Please Sign up or sign in to vote.
See more:

This is my first thrust with COM.. I am not sure I am really clear with the concept though I think I have picked up the basics. I am working on an enhancement with COM. Have gone through quite a few tutorials but I found some stuffs still confusing/unexplained.

I am trying to do the following and this is how and why I am doing. Please comment if it makes sense :

I need to add two new methods [accessors] for an already exising COM implementing class [it implements 3 interfaces currently]. I have done it as below :

i) I have added a new interface[with UUID] in the IDL file. The reason I added a new interface instead of adding to the exisitng one is I suspect, adding new methods would screw up the programs which are already using the interface. Am I correct ?

ii) I see that all interfaces are added inside some co-class in the IDL. I added this new interface to one of the co-class where other related interfaces were defined. But honestly, what does this co-class do ? Is it some kind of a 'abstract class' definition or access point? Should I need to change the UUID now after adding a new interface ?

iii) I added the interface the COM implementing class and put up a COM_INTERFACE_ENTRY(newInterface).

Are the above steps correct or am I missing something ? I see that all other interfaces have a "smart pointer definition" [ex : _COM_SMARTPTR_TYPEDEF(IAtlas2, __uuidof(IAtlas2)); ] but not able to see one for my interface. Why is it so ?

Update : In the COM/OLE viewer, i can see the new interface being defined for the co-class. the problem is "new" .tlh and .tli files are not getting generated even on a complete rebuild.

any help is appreciated,
Posted 29-Oct-10 5:54am
Updated 29-Oct-10 8:15am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

finally, after 4 hours, I fou8nd out what the problem is.. The solution was not running the file which contained #import.. hence, the new interface definition was not available since the new .tlh and .tli files never got created.. Hopefully, this will help some newbie like me.. !!

Btw, if someone could clear the doubts I have, it would be really helpful :

i) I had to add two new functions. if I had added to the existing interfaces which are released, would it have screwed up the interfaces ? Was there a need to add a new interface or was there another way around ?

ii) what exactly does a co-class does ? is it some kind of a abstract class definition [IDL way!!] which gets implemented by a programming language which inherits it ?
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

A coclass is basically the implementation of one or more COM interfaces. Calling clients can be unaware of the coclass since all they care about are the interfaces.

And yes, if you need to enhance a published interface, always add a new interface and have your coclass implement that one too.
GoonerGator 29-Oct-10 17:34pm
Thanks for the reply Nishant.. that was quite helpful..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170924.2 | Last Updated 29 Oct 2010
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100