In a program I'm writting to practice while learning Windows, I often find myself having to inform errors to the user.
Here is a quick example:
Code:
int * starLoc = new int[133];
if ( starLoc == NULL )
{ // if no memory...
MessageBox(NULL,TEXT("Not enough memory to run this application."),
TEXT("Error."),MB_OK | MB_ICONWARNING );
PostQuitMessage(0);
}
Here an array of intergers is created during a WM_PAINT, and if memory is not enough a MessageBox is displayed, and so it will be again and again if any client area region becomes invalid.
I could send a variable to other functions to test conditions and see wheter a new MessageBox should pop or not, but I was wondering if there is any other way to deal with this.