home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
TIMEXSRC.ZIP
/
UA_MISC.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-03-29
|
3KB
|
133 lines
/* ua_misc.c -- Miscellaneous routines for TIMEXUA
February 1990 Mark E. Mallett, Personal Workstation Magazine
This file contains miscellaneous routines for TIMEXUA, including:
err_report Error report routine for errhand stuff
get_events Get list of events from TIMEXBA
*/
#define INCL_WIN
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <os2.h>
#include "timex.h"
#include "ua_timex.h"
#include "ua_pm.h"
#include "ua_baif.h"
/* Local definitions */
/* External data referenced */
extern HWND CurwinH; /* Keeps track of current win */
extern HWND EvlistH; /* Event list handle */
extern HWND MainwinH; /* Main window handle */
/* External routines used */
/* Local data publicly available */
/* Local routines and forward declarations */
/* Private data */
/*
*//* get_events()
Get events from the background server
Accepts :
Returns :
*/
void
get_events( void )
{
EVENT *eventP; /* Ptr to an event */
char evname[100]; /* "Current" event name */
/* Init to first event */
evname[0] = '\0';
/* Clear the list box */
WinSendMsg( EvlistH, LM_DELETEALL, NULL, NULL );
/* Get events from the background agent */
for( ; ; ) {
eventP = ba_getnext( &evname[0] );
if( eventP == NULL )
break;
/* Add the event name to the list box */
WinSendMsg( EvlistH, LM_INSERTITEM,
MPFROM2SHORT( LIT_SORTASCENDING, 0 ),
MPFROMP( eventP->ev_nameP ) );
/* Remember last name for next "get" */
strcpy( &evname[0], eventP->ev_nameP );
/* Delete event */
free( eventP );
}
}
/*
*//* err_report( cond, msgP )
Print an error message on behalf of intercept_error.
Accepts :
code Error code reported
msgP Error message given.
Returns :
0
*/
void
err_report(
int code, /* Error code */
char *msgP /* Message text */
) {
HWND fwinH; /* Handle of window w/ focus */
fprintf( stderr, "timex(%d): %s\n", code, msgP );
#if 0
/* This seemed like a reasonable approach according to the
docs, but the function doesn't exist in the library... */
fwinH = WinQueryFocus( HWND_DESKTOP, FALSE );
#else
/* So we have to clumsily keep track of the current window. */
fwinH = CurwinH;
#endif
WinMessageBox( fwinH, fwinH, msgP, "Warning", 0,
MB_OK | MB_ICONASTERISK | MB_APPLMODAL );
}