home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Reference_Library / lib_examples / displayalert.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-21  |  2.0 KB  |  62 lines

  1. ;/* displayalert.c - Execute me to compile me with SAS C 5.10
  2. LC -b1 -cfistq -v -y -j73 displayalert.c
  3. Blink FROM LIB:c.o,displayalert.o TO displayalert LIBRARY LIB:LC.lib,LIB:Amiga.lib
  4. quit
  5. **
  6. ** This program demonstrates an alert.  An explanation of the positioning
  7. ** values for the alert strings is in the comment that precedes the
  8. ** alertMsg string.
  9. **
  10. ** displayalert.c -  This program implements a recoverable alert
  11. */
  12. #define INTUI_V36_NAMES_ONLY
  13.  
  14. #include <exec/types.h>
  15. #include <intuition/intuition.h>
  16.  
  17. #include <clib/exec_protos.h>
  18. #include <clib/intuition_protos.h>
  19.  
  20. #include <stdio.h>
  21.  
  22. #ifdef LATTICE
  23. int CXBRK(void)    { return(0); }  /* Disable Lattice CTRL/C handling */
  24. int chkabort(void) { return(0); }  /* really */
  25. #endif
  26.  
  27.  
  28. /* Each string requires its own positioning information, as explained
  29. ** in the manual.  Hex notation has been used to specify the positions of
  30. ** the text. Hex numbers start with a backslash, an "x" and the characters
  31. ** that make up the number.
  32. **
  33. ** Each line needs 2 bytes of X position, and 1 byte of Y position.
  34. **   In our 1st line: x = \x00\xF0 (2 bytes) and y = \x14 (1 byte)
  35. **   In our 2nd line: x = \x00\xA0 (2 bytes) and y = \x24 (1 byte)
  36. ** Each line is null terminated plus a continuation character (0=done).
  37. ** This example assumes that the complier will concatenate adjacent
  38. ** strings into a single string with no extra NULLs.  The compiler does
  39. ** add the terminating NULL at the end of the entire string...The entire
  40. ** alert must end in TWO NULLs, one for the end of the string, and one
  41. ** for the NULL continuation character.
  42. */
  43.  
  44. UBYTE *alertMsg =
  45.     "\x00\xF0\x14" "OH NO, NOT AGAIN!" "\x00\x01"
  46.     "\x00\x80\x24" "PRESS MOUSEBUTTON:   LEFT=TRUE   RIGHT=FALSE" "\x00";
  47.  
  48. struct Library *IntuitionBase;
  49.  
  50. VOID main(int argc, char **argv)
  51. {
  52. if (IntuitionBase = OpenLibrary("intuition.library",33))
  53.     {
  54.     if (DisplayAlert(RECOVERY_ALERT, alertMsg, 52))
  55.         printf("Alert returned TRUE\n");
  56.     else
  57.         printf("Alert returned FALSE\n");
  58.  
  59.     CloseLibrary(IntuitionBase);
  60.     }
  61. }
  62.