1

Topic: Best Practies adding of the new interface

Good afternoon.

I only start to master ATL/COM and I can not understand as to add the new additional interface to existing object.

Such in ATL I so understand the master was not present.

At me it turned out to create only the separate project with object at which there is the InterfacesLib and in it the necessary interface...

Then I connect public IDispatchImpl <INewInterface, &__uuidof (INewInterface), &LIBID_NewInterfaceInterfacesLib,/* wMajor = */1>

It is dreary.

I want that I described the interface in idl a file and all.

It is possible?

2

Re: Best Practies adding of the new interface

Hello, script902, you wrote:

S> I can not understand as to add the new additional interface to existing object.


You want to add the description of the new interface in an IDL-file?

Or you wish, having the interface description in an IDL-file, to force a wizard to generate the code for it?

Or the wizard should implement support of the given interface by a class without its declaration in an IDL-file?


If the first then the wizard does not help, it is necessary to describe the interface manually.

Also I will remind that in COM multiple inheritance is forbidden, that is the term "to add the interface" in

Case in point generally it is inapplicable.


If the second then there is nothing easier - select Add Class Wizard, ATL Simple Object or that there

Is better approaches, set parameters and press "Finish". All operation will be incurred by master ATL,

It is required to fill only methods-baby's dummies with sense (that is the code).


Also simply to add in the generated ATL-classes methods and properties, for this purpose there is a special

The wizard, only methods and properties should be added in the interface, instead of in a class.


If the third then again it is necessary to do without a wizard. To add support

The interface a class, it is necessary to add it in the list of inheritance and to implement all its basic methods.

And to place macro COM_INTERFACE_ENTRY in an appropriate place in the class declaration.


And generally, I do not advise to begin learning COM with ATL is corrupts and somewhat

Obscures true. Better at first a hardcore - implementation of COM-servers manually, judgement

IDispatch, IPersist, understanding apartments, connection points, , stream models, etc.

And only then programming with usage ATL which seems fantastic walk.

3

Re: Best Practies adding of the new interface

Hello, okman


Thanks for the answer, but are visible I incorrectly formulated a question...

In a head while puzzle ATL/COM up to the end was not added.

I will try on another:

The project: multicomponent architecture, components interact with each other on standard [within the limits of my project] to interfaces.

I want to achieve that that these "standard [within the limits of my project] interfaces" lay separately in files.idl and them

Imported and implemented immediately classes of components. On similarity of abstract in a C ++.

Implementation of my interfaces will be on STL.

Actually it is all it is peeped in ATL.

I want to find an example of the project with similar architecture, or whether at least to understand the correct direction it is selected.

Or to listen to alternative ways for the big projects.

O> And generally, I do not advise to begin learning COM with ATL is corrupts and somewhat
O> obscures true. Better at first a hardcore  implementation of COM-servers manually, judgement
O> IDispatch, IPersist, understanding apartments, connection points, , stream models, etc.
O> And only then programming with usage ATL which seems fantastic walk.


It agree that the general idea about COM should be and at me it is.

But I do it not "for myself", and "on result" and without usage ATL far will not leave.

COM I read, but I recognize wrote on it a little. Basically there anything difficult, but all is learned in practice.

I am engaged in development on a C ++, and by and large practically for all expert COM wrote similar bicycles for

The projects. Time now came to do it with usage COM.

With interiors ATL I will understand all the same since I am responsible for each line of the code.

4

Re: Best Practies adding of the new interface

Hello, script902, you wrote:

S> the Project: multicomponent architecture, components interact with each other on standard [within the limits of my project] to interfaces.
S> I want to achieve that that these "standard [within the limits of my project] interfaces" lay separately in files.idl and them
S> imported and implemented immediately classes of components. On similarity of abstract in a C ++.


"Inside OLE" already read? If is not present, I advise it to make.

The book heavy, places become outdated, and hardly it is possible to master it entirely from the first.

But on this point in question it can help very strongly, and at the same time save from a spelling

"Bicycles" and  on various "rake". I do not impose everywhere to mold OLE and

Even for simple COM it is far not in each project there is a sense, but there where the sense is,

The given technologies just are very well inscribed.

S> Implementation of my interfaces will be on STL.
S> Actually it is all it is peeped in ATL.
S> I Want to find an example of the project with similar architecture...


Occurs to Microsoft Office.

S>... Or whether at least to understand the correct direction it is selected.
S> Or to listen to alternative ways for the big projects.


The correct direction for what?

"Multicomponent architecture, components interact with each other" is very much the general

The description and the same can be made, for example, through normal dll and any the

System of plug-ins. Than not a variant? Why it is necessary COM?

5

Re: Best Practies adding of the new interface

O> Occurs to Microsoft Office.


I, naturally, meant with source codes

O> "Multicomponent architecture, components interact with each other" is very much the general
O> the description and the same can be made, for example, through normal dll and any the
O> system of plug-ins. Than not a variant? Why it is necessary COM?


System of plug-ins! Through normal dll I also did earlier the system of plug-ins, it and were my bicycles,

There was the , aggregation, registration, interfaces and the dllhell. The new project is even more and for

Versifications, etc. and also supports by other developers are necessary to extensibility rails.

Actually therefore COM.


I already actually promoted in the question.

Thanks you for the help.