MyHandleError
The MyHandleError function is an example of a tool function used to print an error message and exit the calling program. The examples for several CryptoAPI functions in Cryptography Reference and the more extended examples in Using Cryptography implement this function. Real applications may require more complex error handling capability.
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
void MyHandleError(LPTSTR psz)
{
_ftprintf(stderr, TEXT("An error occurred in the program. \n"));
_ftprintf(stderr, TEXT("%s\n"), psz);
_ftprintf(stderr, TEXT("Error number %x.\n"), GetLastError());
_ftprintf(stderr, TEXT("Program terminating. \n"));
exit(1);
} // End of MyHandleError
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for