GetLastError

DWORD nErrorNo = GetLastError ( ); // 得到错误代码
LPSTR lpBuffer;
FormatMessage ( FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_FROM_SYSTEM,NULL,
nErrorNo, // 此乃错误代码,通常在程序中可由 GetLastError()得之
LANG_NEUTRAL,
(LPTSTR) & lpBuffer,
0 ,
NULL );
CString strErrorCause = lpBuffer ? _T(lpBuffer) : _T( " Sorry, cannot find this error info. " );

posted on 2021-12-10 18:44  Earvin  阅读(76)  评论(0编辑  收藏  举报

导航