Click here to Skip to main content
15,921,295 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralProblem with CString::Replace ( LPCTSTR lpszOld, LPCTSTR lpszNew ); Pin
Munkijo31-May-02 2:01
Munkijo31-May-02 2:01 
GeneralRe: Problem with CString::Replace ( LPCTSTR lpszOld, LPCTSTR lpszNew ); Pin
Mazdak31-May-02 2:34
Mazdak31-May-02 2:34 
GeneralRe: Problem with CString::Replace ( LPCTSTR lpszOld, LPCTSTR lpszNew ); Pin
Munkijo31-May-02 7:27
Munkijo31-May-02 7:27 
GeneralRe: Problem with CString::Replace ( LPCTSTR lpszOld, LPCTSTR lpszNew ); Pin
Munkijo31-May-02 7:33
Munkijo31-May-02 7:33 
GeneralRe: Problem with CString::Replace ( LPCTSTR lpszOld, LPCTSTR lpszNew ); Pin
Bill Wilson31-May-02 14:22
Bill Wilson31-May-02 14:22 
GeneralTo Release or Not to Release... Pin
Braulio Dez31-May-02 0:59
Braulio Dez31-May-02 0:59 
GeneralRe: To Release or Not to Release... Pin
Tomasz Sowinski31-May-02 1:21
Tomasz Sowinski31-May-02 1:21 
GeneralRe: To Release or Not to Release... Pin
Len Holgate31-May-02 1:21
Len Holgate31-May-02 1:21 
QI calls AddRef() on your behalf internally, calling it again on the returned pointer means you now have 2 references on the interface pointer and need to call Release() twice...

See: ATLBase.h 5374 (your line numbers may vary Wink | ;) ) for an example QI implementation:
ATLINLINE ATLAPI AtlInternalQueryInterface(
   void* pThis,
   const _ATL_INTMAP_ENTRY* pEntries, 
   REFIID iid, 
   void** ppvObject)
{
   ATLASSERT(pThis != NULL);
   // First entry in the com map should be a simple map entry
   ATLASSERT(pEntries->pFunc == _ATL_SIMPLEMAPENTRY);
   if (ppvObject == NULL)
      return E_POINTER;
   *ppvObject = NULL;
   if (InlineIsEqualUnknown(iid)) // use first interface
   {
      IUnknown* pUnk = (IUnknown*)((int)pThis+pEntries->dw);
      pUnk->AddRef();
      *ppvObject = pUnk;
      return S_OK;
   }
...


Len Holgate
www.jetbyte.com
The right code, right now.
GeneralRe: To Release or Not to Release... Pin
Tomasz Sowinski31-May-02 2:29
Tomasz Sowinski31-May-02 2:29 
GeneralRe: To Release or Not to Release... Pin
Len Holgate31-May-02 2:28
Len Holgate31-May-02 2:28 
GeneralRe: To Release or Not to Release... Pin
Len Holgate31-May-02 1:16
Len Holgate31-May-02 1:16 
GeneralRe: To Release or Not to Release... Pin
Mauricio Ritter31-May-02 1:35
Mauricio Ritter31-May-02 1:35 
Generala question of edit control Pin
31-May-02 0:55
suss31-May-02 0:55 
GeneralRe: a question of edit control Pin
User 665831-May-02 4:45
User 665831-May-02 4:45 
GeneralRe: a question of edit control Pin
ilavl31-May-02 17:07
ilavl31-May-02 17:07 
GeneralRe: a question of edit control Pin
valikac31-May-02 5:15
valikac31-May-02 5:15 
GeneralRe: a question of edit control Pin
Tomasz Sowinski31-May-02 5:32
Tomasz Sowinski31-May-02 5:32 
GeneralRe: a question of edit control Pin
valikac31-May-02 5:27
valikac31-May-02 5:27 
GeneralRe: a question of edit control Pin
Tomasz Sowinski31-May-02 5:38
Tomasz Sowinski31-May-02 5:38 
GeneralRe: a question of edit control Pin
valikac31-May-02 5:36
valikac31-May-02 5:36 
GeneralRe: a question of edit control Pin
Tomasz Sowinski31-May-02 6:01
Tomasz Sowinski31-May-02 6:01 
GeneralRe: a question of edit control Pin
James R. Twine31-May-02 10:26
James R. Twine31-May-02 10:26 
GeneralRe: a question of edit control Pin
ilavl31-May-02 17:10
ilavl31-May-02 17:10 
Questioncallback or thread? Pin
bryce31-May-02 0:00
bryce31-May-02 0:00 
AnswerRe: callback or thread? Pin
Tomasz Sowinski31-May-02 0:10
Tomasz Sowinski31-May-02 0:10 

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.