- Code: Select all Expand view
- void ShowErrorTxt( DWORD dwError )
{
LPVOID lpMsgBuf;
char buffer[ 6 ];
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
dwError,
MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ), // Default language
( LPTSTR ) &lpMsgBuf,
0,
NULL );
sprintf_s( buffer, "%i", dwError );
MessageBox( 0, ( char * ) lpMsgBuf, buffer, 0 );
LocalFree( lpMsgBuf );
}
I post it here so it is usefull for all and I can find it next time