Click here to Skip to main content
16,011,680 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to "new line" in Cstring? Pin
Smith#18-Jul-05 23:43
Smith#18-Jul-05 23:43 
GeneralRe: how to "new line" in Cstring? Pin
Smith#18-Jul-05 23:59
Smith#18-Jul-05 23:59 
AnswerRe: how to "new line" in Cstring? Pin
AndyCheetham19-Jul-05 0:27
AndyCheetham19-Jul-05 0:27 
GeneralITS WORKING!!!! Pin
Smith#19-Jul-05 0:40
Smith#19-Jul-05 0:40 
GeneralRe: ITS WORKING!!!! Pin
toxcct19-Jul-05 1:12
toxcct19-Jul-05 1:12 
AnswerRe: how to "new line" in Cstring? Pin
David Crow19-Jul-05 3:25
David Crow19-Jul-05 3:25 
GeneralUTF8 Code Pin
Veera Raghavendra18-Jul-05 22:40
Veera Raghavendra18-Jul-05 22:40 
GeneralComments on FormatMessage code Pin
Chintoo72318-Jul-05 22:28
Chintoo72318-Jul-05 22:28 
Hi,
I have the following wrapper to FormatMessage that helps the caller not worry about freeing the memory required for the error description string. This works great for me, but I would like to know this can be extended to using in multiple threads too. Any comments and ideas? Thanks in advance.

<br />
_TCHAR *error_string (DWORD errCode)<br />
{<br />
    static _TCHAR szMsgBuf[4096];    <br />
    _TCHAR *pMsgBuf = (_TCHAR *)szMsgBuf;<br />
    DWORD result;<br />
<br />
    ZeroMemory(szMsgBuf, sizeof(szMsgBuf));<br />
<br />
    result = FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,<br />
                            NULL, <br />
                            errCode, <br />
                            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language<br />
                            pMsgBuf, <br />
                            sizeof(szMsgBuf), <br />
                            NULL );<br />
<br />
    if (result == NULL) return NULL;<br />
<br />
    return pMsgBuf;    <br />
}<br />

GeneralRe: Comments on FormatMessage code Pin
Tim Smith19-Jul-05 3:56
Tim Smith19-Jul-05 3:56 
GeneralRe: Comments on FormatMessage code Pin
Chintoo72319-Jul-05 15:41
Chintoo72319-Jul-05 15:41 
GeneralUrgent Pin
TA-RS18-Jul-05 21:58
TA-RS18-Jul-05 21:58 
GeneralRe: Urgent Pin
toxcct18-Jul-05 22:33
toxcct18-Jul-05 22:33 
GeneralRe: Urgent Pin
TA-RS18-Jul-05 22:39
TA-RS18-Jul-05 22:39 
GeneralRe: Urgent [edited] Pin
toxcct18-Jul-05 22:51
toxcct18-Jul-05 22:51 
GeneralRe: Urgent Pin
TA-RS18-Jul-05 23:00
TA-RS18-Jul-05 23:00 
GeneralRe: Urgent Pin
toxcct19-Jul-05 0:11
toxcct19-Jul-05 0:11 
GeneralRe: Urgent [edited] Pin
TA-RS18-Jul-05 23:32
TA-RS18-Jul-05 23:32 
GeneralRe: Urgent [edited] Pin
Cedric Moonen18-Jul-05 23:40
Cedric Moonen18-Jul-05 23:40 
GeneralRe: Urgent [edited] Pin
TA-RS18-Jul-05 23:55
TA-RS18-Jul-05 23:55 
GeneralRe: Urgent [edited] Pin
Marc Soleda18-Jul-05 23:57
Marc Soleda18-Jul-05 23:57 
GeneralRe: Urgent [edited] Pin
Marc Soleda18-Jul-05 23:56
Marc Soleda18-Jul-05 23:56 
GeneralRe: Urgent [edited] Pin
TA-RS19-Jul-05 0:11
TA-RS19-Jul-05 0:11 
GeneralRe: Urgent [edited] Pin
Marc Soleda19-Jul-05 0:17
Marc Soleda19-Jul-05 0:17 
Generalcl.exe Pin
Mr. Naveed Butt18-Jul-05 21:11
professionalMr. Naveed Butt18-Jul-05 21:11 
GeneralRe: cl.exe Pin
Bob Stanneveld18-Jul-05 21:17
Bob Stanneveld18-Jul-05 21:17 

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.