home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / fish / code_examples / cmanual_456 / windows / example6.c < prev    next >
C/C++ Source or Header  |  1990-01-30  |  3KB  |  93 lines

  1. /* Example6                                                             */
  2. /* This program will open a Borderless window which is connected to the */
  3. /* Workbench Screen. It will use all System Gadgets and display it for  */
  4. /* 30 seconds, and then quit.                                           */
  5.  
  6.  
  7.  
  8. /* If your program is using Intuition you should include intuition.h: */
  9. #include <intuition/intuition.h>
  10.  
  11.  
  12.  
  13. struct IntuitionBase *IntuitionBase;
  14.  
  15.  
  16.  
  17. /* Declare a pointer to a Window structure: */ 
  18. struct Window *my_window;
  19.  
  20. /* Declare and initialize your NewWindow structure: */
  21. struct NewWindow my_new_window=
  22. {
  23.   50,            /* LeftEdge    x position of the window. */
  24.   25,            /* TopEdge     y positio of the window. */
  25.   200,           /* Width       200 pixels wide. */
  26.   100,           /* Height      100 lines high. */
  27.   0,             /* DetailPen   Text should be drawn with colour reg. 0 */
  28.   1,             /* BlockPen    Blocks should be drawn with colour reg. 1 */
  29.   NULL,          /* IDCMPFlags  No IDCMP flags. */
  30.   SMART_REFRESH| /* Flags       Intuition should refresh the window. */
  31.   BORDERLESS|    /*             No borders. */
  32.   WINDOWCLOSE|   /*             Close Gadget. */
  33.   WINDOWDRAG|    /*             Drag gadget. */
  34.   WINDOWDEPTH|   /*             Depth arrange Gadgets. */
  35.   WINDOWSIZING|  /*             Sizing Gadget. */
  36.   ACTIVATE,      /*             The window should be Active when opened. */
  37.   NULL,          /* FirstGadget No Custom Gadgets. */
  38.   NULL,          /* CheckMark   Use Intuition's default CheckMark (v). */
  39.   "MY WINDOW",   /* Title       Title of the window. */
  40.   NULL,          /* Screen      Connected to the Workbench Screen. */
  41.   NULL,          /* BitMap      No Custom BitMap. */
  42.   80,            /* MinWidth    We will not allow the window to become */
  43.   30,            /* MinHeight   smaller than 80 x 30, and not bigger */
  44.   300,           /* MaxWidth    than 300 x 200. */
  45.   200,           /* MaxHeight */
  46.   WBENCHSCREEN   /* Type        Connected to the Workbench Screen. */
  47. };
  48.  
  49.  
  50.  
  51. main()
  52. {
  53.   /* Open the Intuition Library: */
  54.   IntuitionBase = (struct IntuitionBase *)
  55.     OpenLibrary( "intuition.library", 0 );
  56.   
  57.   if( IntuitionBase == NULL )
  58.     exit(); /* Could NOT open the Intuition Library! */
  59.  
  60.  
  61.  
  62.   /* We will now try to open the window: */
  63.   my_window = (struct Window *) OpenWindow( &my_new_window );
  64.   
  65.   /* Have we opened the window succesfully? */
  66.   if(my_window == NULL)
  67.   {
  68.     /* Could NOT open the Window! */
  69.     
  70.     /* Close the Intuition Library since we have opened it: */
  71.     CloseLibrary( IntuitionBase );
  72.  
  73.     exit();  
  74.   }
  75.  
  76.  
  77.  
  78.   /* We have opened the window, and everything seems to be OK. */
  79.   /* Wait for 30 seconds: */
  80.   Delay( 50 * 30);
  81.  
  82.  
  83.  
  84.   /* We should always close the windows we have opened before we leave: */
  85.   CloseWindow( my_window );
  86.  
  87.  
  88.   
  89.   /* Close the Intuition Library since we have opened it: */
  90.   CloseLibrary( IntuitionBase );
  91.   
  92.   /* THE END */
  93. }