home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Reference_Library / lib_examples / pubscreenbeep.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-21  |  2.1 KB  |  60 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. #include <exec/types.h>               /* Amiga data types.               */
  8. #include <exec/libraries.h>
  9. #include <intuition/intuition.h>      /* Lots of important Intuition     */
  10. #include <intuition/screens.h>        /* structures we will be using.    */
  11.  
  12. #include <clib/exec_protos.h>         /* Function prototypes             */
  13. #include <clib/intuition_protos.h>
  14.  
  15. #ifdef LATTICE
  16. int CXBRK(void)    { return(0); }     /* Disable Lattice CTRL/C handling */
  17. int chkabort(void) { return(0); }     /* really */
  18. #endif
  19.  
  20. struct Library *IntuitionBase;        /* Intuition library base           */
  21.  
  22. /* Simple example of how to find a public screen to work with in Release 2.
  23.  */
  24.  
  25. VOID main(int argc, char **argv)
  26. {
  27. struct Screen  *my_wbscreen_ptr;     /* Pointer to the Workbench screen */
  28.  
  29. /* Open the library before you call any functions */
  30. IntuitionBase = OpenLibrary("intuition.library",0);
  31. if (NULL != IntuitionBase)
  32.    {
  33.    if(IntuitionBase->lib_Version>=36)
  34.       {
  35.       /* OK, we have the right version of the OS so we can use
  36.       ** the new public screen functions of Release 2 (V36)
  37.       */
  38.       if(NULL!=(my_wbscreen_ptr=LockPubScreen("Workbench")))
  39.           {
  40.           /* OK found the Workbench screen.                      */
  41.           /* Normally the program would be here.  A window could */
  42.           /* be opened or the attributes of the screen copied    */
  43.           DisplayBeep(my_wbscreen_ptr);
  44.  
  45.           UnlockPubScreen(NULL,my_wbscreen_ptr);
  46.           }
  47.       }
  48.    else
  49.       {
  50.       /* Prior to Release 2 (V36), there were no public screens,     */
  51.       /* just Workbench.  In those older systems, windows can be     */
  52.       /* opened on Workbench without locking or a pointer by setting */
  53.       /* the Type=WBENCHSCREEN in struct NewWindow.  Attributes can  */
  54.       /* be obtained by setting the Type argument to WBENCHSCREEN in */
  55.       /* the call to GetScreenData().                                */
  56.       }
  57.    CloseLibrary(IntuitionBase);
  58.    }
  59. }
  60.