Click here to Skip to main content
15,900,511 members
Home / Discussions / COM
   

COM

 
GeneralC++ Client for a C# object Pin
Fragging22-Feb-05 9:14
Fragging22-Feb-05 9:14 
GeneralRe: C++ Client for a C# object Pin
Fragging28-Feb-05 3:08
Fragging28-Feb-05 3:08 
GeneralDifference b/e COM and ActiveX Pin
Muhammad Azam21-Feb-05 23:40
Muhammad Azam21-Feb-05 23:40 
GeneralRe: Difference b/e COM and ActiveX Pin
ThatsAlok22-Feb-05 6:08
ThatsAlok22-Feb-05 6:08 
GeneralRe: Difference b/e COM and ActiveX Pin
Muhammad Azam22-Feb-05 17:24
Muhammad Azam22-Feb-05 17:24 
GeneralRe: Difference b/e COM and ActiveX Pin
ThatsAlok22-Feb-05 18:44
ThatsAlok22-Feb-05 18:44 
GeneralRe: Difference b/e COM and ActiveX Pin
Muhammad Azam22-Feb-05 18:57
Muhammad Azam22-Feb-05 18:57 
QuestionWhat are the rules for changing a published COM interface? Pin
Sir Garence21-Feb-05 15:15
sussSir Garence21-Feb-05 15:15 
I have written a C++ COM object and I now wish to make some alterations to it.

My current understanding of COM is:

- You can't add or remove methods/properties from an interface, nor can you change parameters on existing methods.

Can someone give me a simple explanation (or point me to one) of why I can't add new methods/properties to an interface? I would have thought that as long as I don't change what's already there, it wouldn’t break binary compatibility. I wrote a small test DLL, built a C++ test app based on it, then added new methods to the interface without rebuilding the test app and it didn't break at runtime. Was I just lucky? Are some languages more/less forgiving about this than others?

- Am I allowed to add new values to an enum that is defined in my IDL?

- What if I have a situation like this:

// published interface, already in use by customers


interface MyInterface
{
[id(1)] HRESULT CreateVideo([out, retval] IVideo** p);
}

I now want to add IVideo2 which implements IVideo.

Assuming that it's illegal for me to simply add CreateVideo2([out, retval] IVideo2** p) to MyInterface, the alternative is to create a whole new MyInterface2 just for CreateVideo2(). But if MyInterface is referenced from another interface then I'd have to create a new version of that interface, except it would reference MyInterface2. And what if *that* interface is referenced by yet another interface? I could suddenly find myself doubling the number of interfaces just to accommodate one small change.

Can I instead change the CreateVideo() code to internally create an IVideo2 object but cast it back as IVideo? That way existing clients can still use the unchanged CreateVideo() interface, while newer clients can then cast the returned object back to IVideo2 and get all the new functionality. Or will this break binary compatibility anyway?

I realise that this is kind of ugly because it requires newer developers to know that they can cast the returned IVideo to IVideo2, but it would sure save a lot of my time as well as cut down on interface bloat.

Any thoughts or advice would be much appreciated!

Gary
AnswerRe: What are the rules for changing a published COM interface? Pin
Christian Graus21-Feb-05 15:31
protectorChristian Graus21-Feb-05 15:31 
GeneralRe: What are the rules for changing a published COM interface? Pin
Sir Garence22-Feb-05 4:25
sussSir Garence22-Feb-05 4:25 
GeneralRe: What are the rules for changing a published COM interface? Pin
Christian Graus22-Feb-05 8:41
protectorChristian Graus22-Feb-05 8:41 
GeneralCOM with C# multi client model Pin
sokettepower20-Feb-05 23:50
sokettepower20-Feb-05 23:50 
GeneralRe: COM with C# multi client model Pin
vishalmore21-Feb-05 18:08
vishalmore21-Feb-05 18:08 
QuestionCan we set a global hook in a COM object? Pin
nadzzz20-Feb-05 7:24
nadzzz20-Feb-05 7:24 
AnswerRe: Can we set a global hook in a COM object? Pin
Jörgen Sigvardsson20-Feb-05 9:02
Jörgen Sigvardsson20-Feb-05 9:02 
AnswerRe: Can we set a global hook in a COM object? Pin
vishalmore20-Feb-05 18:23
vishalmore20-Feb-05 18:23 
GeneralError firing callback event Pin
Mayur Mahajan19-Feb-05 19:03
Mayur Mahajan19-Feb-05 19:03 
GeneralIPropertyBag Pin
nsrsetty18-Feb-05 18:33
nsrsetty18-Feb-05 18:33 
GeneralCOM Service Pin
Vinicius Pontes18-Feb-05 0:04
Vinicius Pontes18-Feb-05 0:04 
GeneralRe: COM Service Pin
ThatsAlok19-Feb-05 6:04
ThatsAlok19-Feb-05 6:04 
GeneralRe: COM Service Pin
Vinicius Pontes20-Feb-05 23:38
Vinicius Pontes20-Feb-05 23:38 
GeneralRe: COM Service Pin
ThatsAlok21-Feb-05 0:38
ThatsAlok21-Feb-05 0:38 
GeneralCreate a new Thread Pin
BEamer17-Feb-05 2:25
BEamer17-Feb-05 2:25 
GeneralExcel COM Pin
MJWhiteman217-Feb-05 0:44
MJWhiteman217-Feb-05 0:44 
GeneralRe: Excel COM Pin
MJWhiteman217-Feb-05 3:27
MJWhiteman217-Feb-05 3:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.