Last Updated 2002/10/23
Programming Tips Visual C++ API  索 引 
FormatMessage
2002/10/23

FormatMessage

GetLastError() などで取得したエラーコードの意味を知るには FormatMessage()
が使用出来る.

    LPTSTR lpBuffer;
    FormatMessage(
        FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
        NULL,
        GetLastError(),
        LANG_USER_DEFAULT,
//      MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT),
        (LPTSTR)&lpBuffer,
        0,
        NULL );
    MessageBox(hwnd, lpBuffer, "error message", MB_ICONHAND|MB_OK);
    LocalFree(lpBuffer);


参照
前後のTips
FormatMessage

DSS ProgrammingTipsCGI Ver2.02