Click here to Skip to main content
15,898,371 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: ATLSTR.H & SHOBJIDL.H not found Pin
Douglas Troy19-Jul-05 6:43
Douglas Troy19-Jul-05 6:43 
GeneralRe: ATLSTR.H & SHOBJIDL.H not found Pin
TOMCAT8120-Jul-05 22:24
TOMCAT8120-Jul-05 22:24 
GeneralDuplicate Methos Name in ATL, please help I will rate yr answer Pin
LongIsland16-Jul-05 7:56
LongIsland16-Jul-05 7:56 
GeneralRe: Duplicate Methos Name in ATL, please help I will rate yr answer Pin
Jörgen Sigvardsson16-Jul-05 10:25
Jörgen Sigvardsson16-Jul-05 10:25 
GeneralRe: Duplicate Methos Name in ATL, please help I will rate yr answer Pin
LongIsland16-Jul-05 14:20
LongIsland16-Jul-05 14:20 
GeneralRe: Duplicate Methos Name in ATL, please help I will rate yr answer Pin
Jörgen Sigvardsson16-Jul-05 22:13
Jörgen Sigvardsson16-Jul-05 22:13 
GeneralRe: Duplicate Methos Name in ATL, please help I will rate yr answer Pin
Lim Bio Liong18-Jul-05 3:53
Lim Bio Liong18-Jul-05 3:53 
GeneralRe: Duplicate Methos Name in ATL, please help I will rate yr answer Pin
Lim Bio Liong18-Jul-05 5:53
Lim Bio Liong18-Jul-05 5:53 
Hello Jörgen,

I did me experimentation just a while ago and found that the two (or more) interfaces that has common method names must have a shim class to represent them. For example :


[in ATL]

template <typename T>
class InterfaceAShim : public IDispatchImpl<IInterfaceA, &__uuidof(IInterfaceA), &LIBID_ObjectInterfacesLib, 1, 0>
{
public :
STDMETHOD(Method01)(BSTR stringParam)
{
return static_cast<T*>(this)->InterfaceA_Method01(stringParam);
}
};

template <typename T>
class InterfaceBShim : public IDispatchImpl<IInterfaceB, &__uuidof(IInterfaceB), &LIBID_ObjectInterfacesLib, 1, 0>
{
public :
STDMETHOD(Method01)(BSTR stringParam)
{
return static_cast<T*>(this)->InterfaceB_Method01(stringParam);
}
};

And the implementation class :

class ATL_NO_VTABLE CObjImpl01 :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CObjImpl01, &CLSID_ObjImpl01>,
public ISupportErrorInfo,
public IConnectionPointContainerImpl<CObjImpl01>,
public CProxy_IObjImpl01Events<CObjImpl01>,
public IDispatchImpl<IObjImpl01, &IID_IObjImpl01, &LIBID_ObjectImplementation01Lib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
public InterfaceAShim<CObjImpl01>,
public InterfaceBShim<CObjImpl01>
{
...
...
...
public:
STDMETHOD(InterfaceA_Method01)(BSTR stringParam)
{
return S_OK;
}

STDMETHOD(InterfaceB_Method01)(BSTR stringParam)
{
return S_OK;
}

// Must comment out.
/*
STDMETHOD(Method01)(BSTR stringParam)
{
return S_OK;
}
*/

};

I also found that if I ever define Method01() in the implementation class CObjImpl01 (i.e. by uncommenting it), the Method01()s of the shims never get called. I'm not sure if they are still part of the final compiled code of CObjImpl01.

Any comments, Jörgen ?

Best Regards,
Bio.

GeneralRe: Duplicate Methos Name in ATL, please help I will rate yr answer Pin
Jörgen Sigvardsson19-Jul-05 9:54
Jörgen Sigvardsson19-Jul-05 9:54 
GeneralRe: Duplicate Methos Name in ATL, please help I will rate yr answer Pin
Lim Bio Liong19-Jul-05 13:30
Lim Bio Liong19-Jul-05 13:30 
GeneralQuestion about ATL library ca2wex class Pin
Marcel_115-Jul-05 11:02
Marcel_115-Jul-05 11:02 
GeneralRe: Question about ATL library ca2wex class Pin
Michael Dunn15-Jul-05 14:10
sitebuilderMichael Dunn15-Jul-05 14:10 
General(ATL/COM/MFC/C++) Q about IE programming Pin
dojin7915-Jul-05 0:51
dojin7915-Jul-05 0:51 
GeneralRe: (ATL/COM/MFC/C++) Q about IE programming Pin
Douglas Troy15-Jul-05 5:33
Douglas Troy15-Jul-05 5:33 
GeneralRe: (ATL/COM/MFC/C++) Q about IE programming Pin
Member 212103815-Jul-05 20:23
Member 212103815-Jul-05 20:23 
Questionwhat's the right way to do this? Pin
HeartFriend14-Jul-05 22:31
HeartFriend14-Jul-05 22:31 
AnswerRe: what's the right way to do this? Pin
Douglas Troy15-Jul-05 5:40
Douglas Troy15-Jul-05 5:40 
GeneralRe: what's the right way to do this? Pin
Anonymous15-Jul-05 6:05
Anonymous15-Jul-05 6:05 
GeneralRe: what's the right way to do this? Pin
Douglas Troy15-Jul-05 6:14
Douglas Troy15-Jul-05 6:14 
Generalstd::cin and unbuffering (noncanonical input) Pin
Harold Bamford14-Jul-05 8:08
Harold Bamford14-Jul-05 8:08 
GeneralVector class is missing 'rerase' Pin
ICantChangeMyAcct13-Jul-05 9:18
ICantChangeMyAcct13-Jul-05 9:18 
GeneralRe: Vector class is missing 'rerase' Pin
Nish Nishant13-Jul-05 9:48
sitebuilderNish Nishant13-Jul-05 9:48 
GeneralRe: Vector class is missing 'rerase' Pin
Roland Pibinger13-Jul-05 12:43
Roland Pibinger13-Jul-05 12:43 
GeneralRe: Vector class is missing 'rerase' Pin
Nemanja Trifunovic14-Jul-05 2:19
Nemanja Trifunovic14-Jul-05 2:19 
GeneralRe: Vector class is missing 'rerase' Pin
Rob Caldecott14-Jul-05 5:25
Rob Caldecott14-Jul-05 5:25 

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.