Problem with the coclass in the .idl file

I don't understand i follow the instructions and now this.


error MIDL2233 : too many default interfaces specified for coclass : _ITheServerComObjectEvents [ Coclass 'TheServerComObject'  ]


From the samplecode in:
http://msdn.microsoft.com/workshop/components/activex/part3.asp



When i tried to do the following:
"
You also need to add information to  CTheServerComObject's coclass  declaration at the bottom of the library definition, as follows:
[default, source] interface IMySinkID;
Take a look at the IDL shipped with the sample to see exactly where it should be placed, if necessary.
"









My idl file looks like this:

// TheServer.idl : IDL source for TheServer.dll
//

// This file will be processed by the MIDL tool to
// produce the type library (TheServer.tlb) and marshalling code.

import "oaidl.idl";
import "ocidl.idl";

      [
            object,
            uuid(FA22E144-9D0A-11D3-BD53-006097E3F28A),
            dual,
            helpstring("ITheServerComObject Interface"),
            pointer_default(unique)
      ]
      interface ITheServerComObject : IDispatch
      {
        //import "oaidl.idl";
            HRESULT HelloWorld();
            HRESULT AcceptNewValue([in]long lNewValue,
                       [out, retval] long* lpFormerValue);
      };


//sink interface
[
 object,
 //use guidgen to generate a unique id
 uuid(C02E5360-9DD6-11d3-BD53-006097E3F28A),
 dual,
 helpstring("MySink Interface"),
 pointer_default(unique)
]
interface IMySinkID : IDispatch
{
};









[
      uuid(FA22E138-9D0A-11D3-BD53-006097E3F28A),
      version(1.0),
      helpstring("TheServer 1.0 Type Library")
]

library THESERVERLib
{
      importlib("stdole32.tlb");
      importlib("stdole2.tlb");

      [
            uuid(FA22E146-9D0A-11D3-BD53-006097E3F28A),
            helpstring("_ITheServerComObjectEvents Interface")
      ]
      dispinterface _ITheServerComObjectEvents
      {
            properties:
            methods:
      };

      [
            uuid(FA22E145-9D0A-11D3-BD53-006097E3F28A),
            helpstring("TheServerComObject Class")
      ]


      coclass TheServerComObject
      {
            
            [default] interface ITheServerComObject;
            [default, source] interface IMySinkID;//Error
            [default, source] dispinterface _ITheServerComObjectEvents;
            
      };

};




Please help me.

Your sincerely
andla
LVL 1
andlaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

andlaAuthor Commented:
I cant rind the sourcefiles anywhere.
0
chensuCommented:
A coclass may have at most two default members. One represents the outgoing (source) interface or dispinterface, and the other represents the incoming (sink) interface or dispinterface. Remove one of the "default, source".
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
andlaAuthor Commented:
Witch one must i remove? If i remove the wrong one then changes will probebly destroy the whole project. I wish i could find the sourcefiles for the sample project.
0
chensuCommented:
Just remove the default attribute. You can still keep the interface.

The default attribute Indicates that the interface or dispinterface, defined within a coclass, represents the default programmability interface. This attribute is intended for use by macro languages.
0
andlaAuthor Commented:
The program compiles. :-)

Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.