home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
TIMEXSRC.ZIP
/
UA_MAIN.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-03-29
|
3KB
|
114 lines
/* ua_main.c -- Main routine of the TIMEX user agent
February 1990 Mark E. Mallett, Personal Workstation Magazine
This is the main module of TIMEXUA, the TIMEX user agent
Included are the following routines:
main Main routine
*/
#define INCL_WIN
#include <stdio.h>
#include <os2.h>
#include "errhand.h"
#include "timex.h"
#include "ua_timex.h"
#include "ua_pm.h"
/* Local definitions */
/* External data referenced */
extern HWND CurwinH; /* Currently active window */
extern HWND EvlistH; /* Event list window handle */
extern HWND MainwinH; /* Main window handle */
extern ERRLIST *Werdisp; /* Wild-all error intercept list */
/* External routines used */
extern void err_report( int code, char *msgP );
extern void get_events( void );
extern MRESULT EXPENTRY main_winproc();
/* Local data publicly available */
/* Local routines and forward declarations */
static int main1( void ); /* First continuation of main() */
/* Private data */
static int ArgC; /* Copy of argc */
static char **ArgV; /* Copy of argv */
main(
int argc, /* Argument count */
char **argv /* Argument vector */
) {
/* Save the command line arg vector parms */
ArgC = argc;
ArgV = argv;
/* Create a universal warning interception list */
Werdisp = condition_list( 0, CTINTCEPT );
any_condition( Werdisp, TRUE, err_report );
/* Activate the list and continue to main1() */
intercept_error( main1, (void *)NULL, Werdisp );
return( 0 );
}
static int
main1( void ) {
HAB ab; /* Application anchor block */
HMQ mq; /* Message queue */
QMSG qmsg; /* Message from event queue */
/* Init the application */
ab = WinInitialize( 0 );
mq = WinCreateMsgQueue( ab, 0 );
/* Create the window classes used */
WinRegisterClass( ab, WCMAIN, main_winproc, 0L, 0 );
/* WinRegisterClass( ab, WCEVENT, event_winproc, 0L, 0 ); */
/* Load and init the main window */
MainwinH = WinLoadDlg( HWND_DESKTOP, HWND_DESKTOP, NULL, NULL,
WID_MAIN, NULL );
/* Because of problems generalizing an error window interface,
which must MANUALLY be attached to the current window (ugh),
and because it's not possible to get OS2 to tell you what that
current window IS, we keep track of the current major dialog
window in a global location. ugh. */
CurwinH = MainwinH;
/* Give it input focus since we just started */
WinSetFocus( HWND_DESKTOP, WinWindowFromID( MainwinH, FID_CLIENT ) );
/* Fetch the list of events from the background agent */
get_events();
/* Loop processing events */
while( WinGetMsg( ab, &qmsg, NULL, 0, 0 ) )
WinDispatchMsg( ab, &qmsg );
/* All done */
WinDestroyWindow( MainwinH );
WinDestroyMsgQueue( mq );
WinTerminate( ab );
return( 0 );
}