其他分享
首页 > 其他分享> > GetLastError

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. " );

标签:GetLastError,FORMAT,错误代码,lpBuffer,MESSAGE,NULL
来源: https://www.cnblogs.com/earvin/p/15673401.html