•  Back 
  •  Applications 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  %About 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The ATARI Compendium
Author      : Scott Sanders / JAY Software
Version     : 1.25 (20/6/2003)
Subject     : Documentation
Nodes       : 1117
Index Size  : 32614
HCP-Version : 6
Compiled on : Atari
@charset    : UTF-8
@lang       : en
@default    : 
@help       : %About
@options    : +g -i -t4 +y +z
@width      : 100
View Ref-File
#include <AES.H>
#include <VDI.H>
#include <OSBIND.H>
#include <VDIWORK.H>
#include "skel.h"

#define CNTRL_Q 0x11

int main(int, char *[]);

extern int _AESglobal[15];

short ap_id;
VDI_Workstation ws;     /* See entry for V_Opnvwk() in VDI docs */
OBJECT *mainmenu;

char RSCname[] = "skeleton.rsc";
char menu_title[] = "  Skeleton";

int
main(int argc, char *argv[])
{
    char *altNoVDIWork = "[3][GEM is unable to|allocate a workstation.|The program  must abort.][ OK
]";
    char *altNoRSC = "[3][The program cannot locate|SKELETON.RSC. Please ensure|that it resides in
the|same directory as|SKELETON.PRG.][ OK ]";
    short ret,msg[8],kc,quit,dum;

    ap_id = appl_init();
    if(ap_id == -1)
            return -1;

    if(!OpenVwork(&ws))
    {
            graf_mouse( ARROW, 0L );
            form_alert(1, altNoVDIWork );
            appl_exit();
            return -1;
    }

    if(!rsrc_load( RSCname ))
    {
            graf_mouse( ARROW, 0L );
            form_alert(1, altNoRSC );
            v_clsvwk(ws.handle);
            appl_exit();
            return -1;
    }

    if(_AESglobal[1] == -1)                         /* MultiTOS present?      */
            menu_register(ap_id, menu_title);       /* Yes, make name pretty. */

    rsrc_gaddr( R_TREE, MAINMENU, &mainmenu);

    menu_bar(mainmenu,1);
    graf_mouse( ARROW, 0L );

    quit = FALSE;
    while(!quit)
    {
            ret = evnt_multi(MU_MESAG|MU_KEYBD,2,1,1,0,0,0,0,0,0,0,0,0,0,msg,0,0,
                                &dum,&dum,&dum,&dum,&kc,&dum);

            if(ret & MU_MESAG)
            {
                switch(msg[0])
                {
                    case MN_SELECTED:
                        switch(msg[3])
                        {
                            .       /* Other menu selections */
                            .
                            .

                            case mmExit:                    /* Defined in SKEL.H */
                                quit = TRUE;
                                break;
                        }
                        break;
                    }
                }
            }

            if(ret & MU_KEYBD)
            {
                switch(kc & 0xFF)
                {
                    .           /* Other keyboard equivalents */
                    .
                    .
                    case CNTRL_Q:
                        quit = TRUE;
                        break;
                }
            }
    }

    menu_bar( mainmenu, 0 );
    v_clsvwk(ws.handle);
    rsrc_free();
    appl_exit();
    return 0;
}