home *** CD-ROM | disk | FTP | other *** search
/ Megahits 4 / MegaHits_Vol.4.iso / mui / dev / gui / muib_modulec.lha / muib_generator / Main.c < prev    next >
C/C++ Source or Header  |  1994-04-10  |  1KB  |  70 lines

  1. /* Libraries */
  2. #include <libraries/mui.h>
  3.  
  4. /* protos */
  5. #include <clib/muimaster_protos.h>
  6. #include <clib/alib_protos.h>
  7. #include <clib/dos_protos.h>
  8. #include <clib/exec_protos.h>
  9.  
  10. /*  Pragmas  */
  11. #include <pragmas/muimaster_pragmas.h>
  12. #include <pragmas/exec_pragmas.h>
  13.  
  14. /*  Ansi  */
  15. #include <stdlib.h>
  16. #include <stdio.h>
  17.  
  18. /* MUIBuilder */
  19. #include "MUIDemo.h"
  20.  
  21. struct Library * MUIMasterBase;
  22.  
  23. /* Init function */
  24. static void init( void )
  25. {
  26.     if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
  27.     {
  28.         printf("Can't Open MUIMaster Library");
  29.         exit(20);
  30.     }
  31. }
  32.  
  33. static void ExitPrg( void )
  34. {
  35.     CloseLibrary(MUIMasterBase);
  36.         exit(0);
  37. }
  38.  
  39. /* main function */
  40. main()
  41. {
  42.     BOOL    running = TRUE;
  43.     ULONG    signal;
  44.  
  45.     /* Program initialisation ( you need to write it yourself) */
  46.     init();
  47.  
  48.     /* Create Application : generated by MUIBuilder */
  49.     if (!CreateApp()) ExitPrg();
  50.  
  51.     /* Notification */
  52.     DoMethod(WI_main, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, App, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
  53.     
  54.     /* Open Window */
  55.     set( WI_main, MUIA_Window_Open, TRUE );
  56.  
  57.     while (running)
  58.         {
  59.                 switch (DoMethod(App,MUIM_Application_Input,&signal))
  60.                 {
  61.                 case MUIV_Application_ReturnID_Quit:
  62.                         running = FALSE;
  63.                         break;
  64.                 }
  65.         if (running && signal) Wait(signal);
  66.         }
  67.     DisposeApp();
  68.     ExitPrg();
  69. }
  70.