Zipster: Well, you can enclose your current code in main() in a try {} block, and put a catch() statement after the try {} block. Then, from that catch() statement, just call your function. throw() whatever you need that function to use when an error occurs, and the program will clean itself up all the way to main() and let your function handle it. You may want to release DX and then put up a dialog box with the data from the exception that you threw. Basically, whatever you want!
Here''s a little snippet, in case I explained it oddly:
// Whenever you want to throw an exception,
// just fill in a MYEXCEPTIONINFO struct and
// throw it.
struct MYEXCEPTIONINFO {
const char* pSourceFileName;
const char* pSourceLineNumber;
int myinformation; // define anything you want
}
void main()
{
try {
GameInit(); // contains initialization stuff
GameRun(); // contains message loop
GameExit(); // contains uninitialization stuff
}
catch( struct MYEXCEPTIONINFO ) {
// do whatever -- call your function if you like
}
}
- null_pointer
Sabre Multimedia