Annotation of pmsdk/samples/petzold/chap17/bigjobmt.c, revision 1.1.1.1

1.1       root        1: /*------------------------------------------------------------
                      2:    BIGJOBMT.C -- Common functions used in BIGJOB4 and BIGJOB5
                      3:   ------------------------------------------------------------*/
                      4: 
                      5: #define INCL_WIN
                      6: #include <os2.h>
                      7: #include <mt\math.h>
                      8: #include <mt\stdio.h>
                      9: 
                     10: double Savage (double A)
                     11:      {
                     12:      return tan (atan (exp (log (sqrt (A * A))))) + 1.0 ;
                     13:      }
                     14: 
                     15: VOID CheckMenuItem (HWND hwnd, SHORT sMenuItem, BOOL fCheck)
                     16:      {
                     17:      HWND  hwndParent = WinQueryWindow (hwnd, QW_PARENT, FALSE) ;
                     18:      HWND  hwndMenu   = WinWindowFromID (hwndParent, FID_MENU) ;
                     19: 
                     20:      WinSendMsg (hwndMenu, MM_SETITEMATTR,
                     21:                  MPFROM2SHORT (sMenuItem, TRUE),
                     22:                  MPFROM2SHORT (MIA_CHECKED, fCheck ? MIA_CHECKED : 0)) ;
                     23:      }
                     24: 
                     25: VOID EnableMenuItem (HWND hwnd, SHORT sMenuItem, BOOL fEnable)
                     26:      {
                     27:      HWND  hwndParent = WinQueryWindow (hwnd, QW_PARENT, FALSE) ;
                     28:      HWND  hwndMenu   = WinWindowFromID (hwndParent, FID_MENU) ;
                     29: 
                     30:      WinSendMsg (hwndMenu, MM_SETITEMATTR,
                     31:                  MPFROM2SHORT (sMenuItem, TRUE),
                     32:                  MPFROM2SHORT (MIA_DISABLED, fEnable ? 0 : MIA_DISABLED)) ;
                     33:      }
                     34: 
                     35: VOID PaintWindow (HWND hwnd, SHORT sStatus, LONG lCalcRep, ULONG ulTime)
                     36:      {
                     37:      static CHAR *szMessage [3] = { "Ready", "Working...",
                     38:                                     "%ld repetitions in %lu msec." } ;
                     39:      CHAR        szBuffer [60] ;
                     40:      HPS         hps ;
                     41:      RECTL       rcl ;
                     42: 
                     43:      hps = WinBeginPaint (hwnd, NULL, NULL) ;
                     44:      WinQueryWindowRect (hwnd, &rcl) ;
                     45: 
                     46:      sprintf (szBuffer, szMessage [sStatus], lCalcRep, ulTime) ;
                     47:      WinDrawText (hps, -1, szBuffer, &rcl, CLR_NEUTRAL, CLR_BACKGROUND,
                     48:                   DT_CENTER | DT_VCENTER | DT_ERASERECT) ;
                     49: 
                     50:      WinEndPaint (hps) ;
                     51:      }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.