home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / WINLBSRC.ZIP / ERREXIT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.1 KB  |  51 lines

  1. /*------------------------------------------------------------------------
  2.  * filename - errexit.c
  3.  *
  4.  * function(s)
  5.  *-----------------------------------------------------------------------*/
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 5.0
  9.  *
  10.  *      Copyright (c) 1987, 1992 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14.  
  15. #if !defined( __STDLIB_H )
  16. #include <stdlib.h>
  17. #endif  // __STDLIB_H
  18.  
  19. #if !defined( ___WIN_H )
  20. #include <_win.h>
  21. #endif  // ___WIN_H
  22.  
  23. #if !defined( __WINDOWS_H )
  24. #include <windows.h>
  25. #endif  // __WINDOWS_H
  26.  
  27. #if !defined( __STRING_H )
  28. #include <string.h>
  29. #endif  // __STRING_H
  30.  
  31. extern char *_Cdecl _argv0;
  32. extern HWND _hInstance;
  33.  
  34. void _errorBox(char *msg)
  35. {
  36.     char _FAR *progName = strrchr(_argv0, '\\');
  37.     if (progName == NULL)
  38.         progName = _argv0;
  39.     else
  40.         progName++;     // skip backslash in front of name
  41.  
  42.     MessageBox(GetDesktopWindow(), msg, progName,
  43.                 MB_ICONHAND | MB_SYSTEMMODAL);
  44. }
  45.  
  46. void _errorExitBox(char *msg, int code)
  47. {
  48.     _errorBox(msg);
  49.     _exit(code);
  50. }
  51.