#include <Windows.h>
#include <strsafe.h>
void ErrorExit()
{
void * lpMsgBuf;
FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(char *)&lpMsgBuf,
0,
NULL);
printf("**************************** error = %s\n", lpMsgBuf);
LocalFree(lpMsgBuf);
}
int main()
{
if( ! GetProcessId(NULL) )
{
ErrorExit();
}
return 0;
}