Click here to Skip to main content
15,885,742 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

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,
Shishir
Posted
Updated 29-Oct-10 8:15am
v2

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 ?
 
Share this answer
 
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.
 
Share this answer
 
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900