home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d155 / nosmoking.lha / NoSmoking / NoSmoking.c < prev    next >
C/C++ Source or Header  |  1988-10-02  |  2KB  |  67 lines

  1. /* NO SMOKING ALERT  - by T. Kermanidis */
  2.  
  3. /* this program will display a recoverable GURU with an appropriate message */
  4.  
  5. #include <exec/types.h>
  6. #include <intuition/intuition.h>
  7.  
  8. /* intuition bits */
  9.  
  10. #define IBASE  31
  11. struct IntuitionBase *IntuitionBase = NULL;
  12.  
  13. /* alert message */
  14.  
  15. #define MESSAGE_HEIGHT 63
  16.  
  17. UBYTE NoSmokingMessage[] =
  18.    "\x00\x6C\x14The GURU advises that smoking is bad for your health.\x00\xFF\x01\x16\x22so please,\x00\xFF\x01\x14\x30No Smoking!\x00";
  19.  
  20. /* If you want to customize your message then you must change the text in
  21.    the above string.
  22.  
  23.    The necessary format of the string for the ALERT routines to properly
  24.    display your message is as follows,
  25.  
  26.    xxxx yy <text....> zz cc     -- format of alert text string
  27.  
  28.    the meaning of the of the above characters in the format are explained as
  29.    follows, (note: each character x,y,z,c represents 4 bits of data, a
  30.    hexadecimal digit.)
  31.  
  32.    xxxx  -  a 16 bit number representing the x position of the start of
  33.             the message.
  34.    yy    -  an 8 bit number representing the y position of the message.
  35.  
  36.    <text...>  this just means the text of the message
  37.  
  38.    zz    -  must be set to zero always. i.e. \0
  39.  
  40.    cc    -  continuation byte, if zero ...... no more text messages
  41.                                if non zero .. more text to follow.
  42.  
  43.    Note when the format is done as in this program the end (continuation
  44.    byte) is missing. This is because C automatically make strings null
  45.    terminated. */
  46.  
  47.  
  48.  
  49. /* display a recoverable alert */
  50.  
  51. VOID NoSmoking()
  52.   {
  53.    (VOID )DisplayAlert (RECOVERY_ALERT,NoSmokingMessage,MESSAGE_HEIGHT);
  54.   }
  55.  
  56. /* main entry point */
  57.  
  58. main()
  59.   {
  60.    if ((IntuitionBase = (struct IntuitionBase *)
  61.         OpenLibrary("intuition.library",IBASE)) != NULL)
  62.      {
  63.       NoSmoking();
  64.       CloseLibrary (IntuitionBase);
  65.      }
  66.   }
  67.