I don't think you're correct. If you look at the pointer values returned as integers, they will not be the same -- they reference different vtables belonging to the same object. (ISearch does not inherit from [aka extend] IDispatch; it does not have IDispatch's methods in its vtable.) The fact that you could QI either one to obtain the other does not mean that they are interchangeable.
At 02:08 PM 3/6/2006, Wilson, Phil D wrote >If ISearch is dual, it is also an IDispatch, so existing clients who >expect an IDispatch are still getting an IDispatch. He's returning a new >interface that implements the prior one, so I don't think any COM rule >is being broken. > >Phil Wilson > >-----Original Message----- >From: Discussion of advanced .NET topics. >[mailto:[EMAIL PROTECTED] On Behalf Of Steve Johnson >Sent: Sunday, March 05, 2006 5:09 AM >To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM >Subject: Re: [ADVANCED-DOTNET] Safe to modify IDL to change from >IDispatch to a different Interface? > >On 3/4/06, Josh Gough <[EMAIL PROTECTED]> wrote: >> >> >> My question is: is it safe to do this? Is there anything I should >> watch out for or could this cause any problems somehow? >> > > >Absolutely not. You're getting by with it because you're only using the >tlb to generate a RCW and not for anything else. The RCW (IIRC), is >going to explicitly QI the retval for the ISearch interface, so it's >working now. >However, the retval is not actually an ISearch*, its an IDispatch*, so >although it's working for you, you've obfuscated the true interface of >the COM component. > >-- >Steve Johnson J. Merrill / Analytical Software Corp =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com