#include <windows.h>
int WINAPI WinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in_opt LPSTR lpCmdLine, __in int nShowCmd )
{
ExitWindowsEx(EWX_SHUTDOWN|EWX_POWEROFF,0); //这是运行错误的代码,把它放在前面,然后用下面的代码来显示错误
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0,
NULL
);
MessageBox(NULL,(LPCTSTR)lpMsgBuf,L"",MB_OK);
LocalFree( lpMsgBuf );
return 0;
}