home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 5 / FreshFish_July-August1994.bin / bbs / dev / rkrm.lha / RKRM / Intuition / Screens / pubscreenbeep.c < prev    next >
C/C++ Source or Header  |  1992-09-03  |  3KB  |  87 lines

  1. ;/* pubscreenbeep.c - Execute me to compile me with SAS 5.10
  2. LC -b1 -cfistq -v -y -j73 pubscreenbeep.c
  3. blink LIB:c.o pubscreenbeep.o TO pubscreenbeep LIB LIB:lc.lib LIB:amiga.lib
  4. quit
  5. */
  6.  
  7. /*
  8. Copyright (c) 1992 Commodore-Amiga, Inc.
  9.  
  10. This example is provided in electronic form by Commodore-Amiga, Inc. for
  11. use with the "Amiga ROM Kernel Reference Manual: Libraries", 3rd Edition,
  12. published by Addison-Wesley (ISBN 0-201-56774-1).
  13.  
  14. The "Amiga ROM Kernel Reference Manual: Libraries" contains additional
  15. information on the correct usage of the techniques and operating system
  16. functions presented in these examples.  The source and executable code
  17. of these examples may only be distributed in free electronic form, via
  18. bulletin board or as part of a fully non-commercial and freely
  19. redistributable diskette.  Both the source and executable code (including
  20. comments) must be included, without modification, in any copy.  This
  21. example may not be published in printed form or distributed with any
  22. commercial product.  However, the programming techniques and support
  23. routines set forth in these examples may be used in the development
  24. of original executable software products for Commodore Amiga computers.
  25.  
  26. All other rights reserved.
  27.  
  28. This example is provided "as-is" and is subject to change; no
  29. warranties are made.  All use is at your own risk. No liability or
  30. responsibility is assumed.
  31. */
  32.  
  33.  
  34. #include <exec/types.h>               /* Amiga data types.               */
  35. #include <exec/libraries.h>
  36. #include <intuition/intuition.h>      /* Lots of important Intuition     */
  37. #include <intuition/screens.h>        /* structures we will be using.    */
  38.  
  39. #include <clib/exec_protos.h>         /* Function prototypes             */
  40. #include <clib/intuition_protos.h>
  41.  
  42. #ifdef LATTICE
  43. int CXBRK(void)    { return(0); }     /* Disable Lattice CTRL/C handling */
  44. int chkabort(void) { return(0); }     /* really */
  45. #endif
  46.  
  47. struct Library *IntuitionBase;        /* Intuition library base           */
  48.  
  49. /* Simple example of how to find a public screen to work with in Release 2.
  50.  */
  51.  
  52. VOID main(int argc, char **argv)
  53. {
  54. struct Screen  *my_wbscreen_ptr;     /* Pointer to the Workbench screen */
  55.  
  56. /* Open the library before you call any functions */
  57. IntuitionBase = OpenLibrary("intuition.library",0);
  58. if (NULL != IntuitionBase)
  59.    {
  60.    if(IntuitionBase->lib_Version>=36)
  61.       {
  62.       /* OK, we have the right version of the OS so we can use
  63.       ** the new public screen functions of Release 2 (V36)
  64.       */
  65.       if(NULL!=(my_wbscreen_ptr=LockPubScreen("Workbench")))
  66.           {
  67.           /* OK found the Workbench screen.                      */
  68.           /* Normally the program would be here.  A window could */
  69.           /* be opened or the attributes of the screen copied    */
  70.           DisplayBeep(my_wbscreen_ptr);
  71.  
  72.           UnlockPubScreen(NULL,my_wbscreen_ptr);
  73.           }
  74.       }
  75.    else
  76.       {
  77.       /* Prior to Release 2 (V36), there were no public screens,     */
  78.       /* just Workbench.  In those older systems, windows can be     */
  79.       /* opened on Workbench without locking or a pointer by setting */
  80.       /* the Type=WBENCHSCREEN in struct NewWindow.  Attributes can  */
  81.       /* be obtained by setting the Type argument to WBENCHSCREEN in */
  82.       /* the call to GetScreenData().                                */
  83.       }
  84.    CloseLibrary(IntuitionBase);
  85.    }
  86. }
  87.