Re: passing a string to a dll
Hi Tom,
"Tom Serface" <tom.nospam@camaswood.com> ha scritto nel messaggio
news:uds8uys%23HHA.3916@TK2MSFTNGP02.phx.gbl...
I would guess that in your example _T("Testing") simply remains a LPCTSTR
rather than getting converted to a CString for the comparison :o)
You're right :)
This is because it seems that there is an operator== overload, which takes
CString reference as first argument, and LPCTSTR as second argument:
_AFX_INLINE bool AFXAPI operator==(const CString& s1, LPCTSTR s2)
{ return s1.Compare(s2) == 0; }
So the operator== invokes CString::Compare method:
_AFX_INLINE int CString::Compare(LPCTSTR lpsz) const
I think your definitions for CStringT are a little dated though :o) Are
you using 6.0?
Hmm... I think that CString is a non-template class in VC6; CString started
to be a template since VC7.1; in fact I believe that in VC6's MFC there is
no CStringT, just CString; instead, in VC7.1 there is CStringT:
template< typename BaseType, class StringTraits >
class CStringT
CString, CStringA, CStringW, CAtlString, CAtlStringA, CAtlStringW are all
instantiation of CStringT template, with different char types and traits.
Giovanni