home *** CD-ROM | disk | FTP | other *** search
- /*_______________________________________________________________________
- | _|_ |
- | ¿ GenericErrors 12/18/91 |
- | |
- | Simply call the routines like so: |
- | |
- | FatalError("\pSorry, an error has occured."); |
- | StopError("\pSorry, an error has occured."); |
- | CautionError("\pSorry, an error has occured."); |
- | Message("\pSorry, an error has occured."); |
- | |
- | Copyright © 1991 by Craig A. Marciniak All rights reserved. |
- _______________________________________________________________________*/
-
- #define ERRORTEMPLATE 200
-
- /*_________________________ Generic FatalError ________________________*/
-
- void FatalError(char *message)
- {
- ParamText(message,NULL,NULL,NULL);
- CenterDialog ('ALRT',ERRORTEMPLATE);
- StopAlert(ERRORTEMPLATE,NIL);
- ExitToShell();
- }
-
- /*_________________________ Generic StopError __________________________*/
-
- void StopError(char *message)
- {
- ParamText(message,NULL,NULL,NULL);
- CenterDialog ('ALRT',ERRORTEMPLATE);
- StopAlert(ERRORTEMPLATE,NIL);
- }
-
- /*_______________________ Generic Caution Error ________________________*/
-
- void CautionError(char *message)
- {
- ParamText(message,NULL,NULL,NULL);
- CenterDialog ('ALRT',ERRORTEMPLATE);
- CautionAlert(ERRORTEMPLATE,NIL);
- }
-
- /*_________________________ Generic Message ____________________________*/
-
- void Message(char *message)
- {
- ParamText(message,NULL,NULL,NULL);
- CenterDialog ('ALRT',ERRORTEMPLATE);
- NoteAlert(ERRORTEMPLATE,NIL);
- }
-
- /*_________________ Center dialog or alert template ____________________*/
- /* pass 'ALRT' or 'DLOG' for templateType */
-
- void CenterDialog (long templateType,short templateID)
- {
- register Rect **h;
- register Rect *p;
- register short width, height;
-
- if (!(h = (Rect **)GetResource(templateType, templateID)))
- return;
- p = *h;
- width = p->right - p->left;
- height = p->bottom - p->top;
- p->top = 20 + screenBits.bounds.top +
- ((screenBits.bounds.bottom - screenBits.bounds.top) - height)/3;
- p->bottom = p->top + height;
- p->left = screenBits.bounds.left +
- ((screenBits.bounds.right - screenBits.bounds.left) - width)/2;
- p->right = p->left + width;
- }
-
- /*______________________________________________________________________*/