Re: CString help
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Thu, 21 Jun 2007 19:12:13 -0400
First, you are likely reading my essay.
So why would you need to call CString::GetBuffer in a MessageBox call? There's no useful
purpose served by doing that. In fact, you should be doing
AfxMessageBox(cString, MB_OK);
Microsoft guidelines say the title should be the name of the program, so there is no
reason to use a different title. There is no reason to use m_hWnd since there is already
a CWnd::MessageBox call, so you would write
MessageBox(cString, lpTitle, MBOK);
So your complaint is that you are doing something unnecessary?
joe
On Thu, 21 Jun 2007 14:17:04 -0500, "jp2code" <poojo.com/mail> wrote:
I'm looking at a website on CString Management:Joseph M. Newcomer [MVP]
http://www.codeproject.com:80/string/cstringmgmt.asp
In the section entitled, "CString to char * II: Using GetBuffer," the author
stresses calling ReleaseBuffer after calling GetBuffer.
Is this always necessary?
I often use CString::GetBuffer when using CStrings in MessageBox dialogs
like so:
MessageBox(m_hWnd, cString.GetBuffer(0), lpTitle, MB_OK);
Should I be adding a ReleaseBuffer after a MessageBox call?
Should I be passing my string data to the MessageBox in another way?
Regards,
Joe
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: CString help
- From: Mihai N.
- Re: CString help
- References:
- CString help
- From: jp2code
- CString help
- Prev by Date: Re: font names starting with @
- Next by Date: Re: Debug Assertation Failed
- Previous by thread: Re: CString help
- Next by thread: Re: CString help
- Index(es):
Relevant Pages
|