Click here to Skip to main content
15,905,420 members
Home / Discussions / COM
   

COM

 
GeneralRe: COM object pooling Pin
Daniel Turini17-Nov-02 22:36
Daniel Turini17-Nov-02 22:36 
GeneralRe: COM object pooling Pin
Dudi Avramov17-Nov-02 23:49
Dudi Avramov17-Nov-02 23:49 
GeneralRe: COM object pooling Pin
Daniel Turini18-Nov-02 0:32
Daniel Turini18-Nov-02 0:32 
GeneralRe: COM object pooling Pin
Ranjan Banerji18-Nov-02 3:45
Ranjan Banerji18-Nov-02 3:45 
GeneralRe: COM object pooling Pin
Dudi Avramov18-Nov-02 4:10
Dudi Avramov18-Nov-02 4:10 
GeneralRe: COM object pooling Pin
Ranjan Banerji18-Nov-02 7:14
Ranjan Banerji18-Nov-02 7:14 
GeneralRe: COM object pooling Pin
Dudi Avramov18-Nov-02 20:58
Dudi Avramov18-Nov-02 20:58 
GeneralRe: COM object pooling Pin
geo_m25-Nov-02 22:47
geo_m25-Nov-02 22:47 
Hi,

This is some misundestanding, based on fact, that in ATL the CComObject is used in some other way than other classes. So if you want to override the CComObject functionality, you have to realize, that this is the class which will be derived from yours (CComObject is the topmost in the hierarchy)
Then the code will looks like that:

template <class Base><br />
class  CMyComObject: public CComObject<Base><br />
{};


this will create CMyComObject, where you can override required functions and do whatever you want to. But this is only the half way to the goal.

Then, for allowing a creation of your specialized (pooled) COM, you have to create a class factory -

<br />
template <class T><br />
class CMyComClassFactory : public CComClassFactory<br />
{<br />
};


there is the most important function to be overrided (at least) - CreateInstance(...). Inside this function you will create your object in a way like that:

CMyComObject<T>::CreateInstance(&m_pObj) ;

(note the ..My.. in CMyComObject)

and the last point to achieve the custom-creation is to declare following macro inside your com class

DECLARE_CLASSFACTORY_EX(CMyComClassFactory<class> )

for that I use some macro defined:
#define DECLARE_MY_CLASSFACTORY(obj) DECLARE_CLASSFACTORY_EX(CMyComClassFactory<obj> )
then your component code will looks like:

class CMySuperPooledComponent : public ...whatewer was there...<br />
{<br />
DECLARE_MY_CLASSFACTORY(CMySuperPooledComponent);<br />
};


I hope this will helps you to achive whatever you want to. It looks quite complicated, then if you will need some more help, don't hesitate to contact me on my e-mail (-nospam)
GeneralRe: COM object pooling Pin
Dudi Avramov27-Nov-02 4:45
Dudi Avramov27-Nov-02 4:45 
GeneralRe: COM object pooling Pin
geo_m29-Nov-02 22:19
geo_m29-Nov-02 22:19 
GeneralRe: COM object pooling Pin
Dudi Avramov30-Nov-02 20:47
Dudi Avramov30-Nov-02 20:47 
GeneralNeed help in accessing ATL COM property of type coclass. Pin
bahruddina15-Nov-02 5:38
bahruddina15-Nov-02 5:38 
GeneralRe: Need help in accessing ATL COM property of type coclass. Pin
Hans Ruck17-Nov-02 4:44
Hans Ruck17-Nov-02 4:44 
Generalpass an array from C# to a COM object Pin
gharrison14-Nov-02 21:09
gharrison14-Nov-02 21:09 
GeneralRe: pass an array from C# to a COM object Pin
Christian Graus17-Nov-02 8:24
protectorChristian Graus17-Nov-02 8:24 
QuestionCComPtr or CComQIPtr??? Pin
LukeV14-Nov-02 4:08
LukeV14-Nov-02 4:08 
AnswerRe: CComPtr or CComQIPtr??? Pin
ian mariano14-Nov-02 6:56
ian mariano14-Nov-02 6:56 
GeneralSAFEARRAY - Multidimensions Pin
Dave Loeser13-Nov-02 6:16
Dave Loeser13-Nov-02 6:16 
GeneralRe: SAFEARRAY - Multidimensions Pin
Vi217-Nov-02 20:45
Vi217-Nov-02 20:45 
GeneralDealing with CWnd* as parents Pin
Dave_12-Nov-02 3:41
Dave_12-Nov-02 3:41 
GeneralMFC ActiveX and Admin rights Pin
Paul Selormey11-Nov-02 20:15
Paul Selormey11-Nov-02 20:15 
GeneralRe: MFC ActiveX and Admin rights Pin
Renjith Ramachandran22-Nov-02 2:24
Renjith Ramachandran22-Nov-02 2:24 
GeneralPassing files Pin
Scracha11-Nov-02 4:48
Scracha11-Nov-02 4:48 
GeneralRe: Passing files Pin
Steve S11-Nov-02 6:58
Steve S11-Nov-02 6:58 
GeneralRe: Passing files Pin
Scracha13-Nov-02 3:42
Scracha13-Nov-02 3:42 

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.