home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / BIGJOB.ZIP / BIGJOB.H next >
C/C++ Source or Header  |  1989-03-27  |  2KB  |  77 lines

  1. /*----------------------
  2.    BIGJOB.H header file
  3.   ----------------------*/
  4.  
  5. #define ID_RESOURCE 1
  6.  
  7. #define IDM_REPS    1
  8. #define IDM_ACTION  2
  9.  
  10. #define IDM_10      10
  11. #define IDM_100     100
  12. #define IDM_1000    1000
  13. #define IDM_10000   10000
  14.  
  15. #define IDM_START   20
  16. #define IDM_ABORT   21
  17.  
  18.      /*-----------------------------------------------------
  19.         Definitions, functions, and variables for BIGJOBx.C
  20.        -----------------------------------------------------*/
  21.  
  22. #ifndef RC_INVOKED       /* This stuff not needed for .RC file */
  23.  
  24. #define STATUS_READY     0
  25. #define STATUS_WORKING   1
  26. #define STATUS_DONE      2
  27.  
  28. MRESULT EXPENTRY ClientWndProc (HWND, USHORT, MPARAM, MPARAM) ;
  29.  
  30. HAB  hab ;
  31.  
  32. double Savage (double A)
  33.      {
  34.      return tan (atan (exp (log (sqrt (A * A))))) + 1.0 ;
  35.      }
  36.  
  37. VOID CheckMenuItem (HWND hwnd, SHORT iMenuItem, BOOL bCheck)
  38.      {
  39.      HWND hwndParent = WinQueryWindow (hwnd, QW_PARENT, FALSE) ;
  40.      HWND hwndMenu   = WinWindowFromID (hwndParent, FID_MENU) ;
  41.  
  42.      WinSendMsg (hwndMenu, MM_SETITEMATTR, MPFROM2SHORT(iMenuItem, TRUE),
  43.                  MPFROM2SHORT(MIA_CHECKED, bCheck ? MIA_CHECKED : 0)) ;
  44.      }
  45.  
  46. VOID EnableMenuItem (HWND hwnd, SHORT iMenuItem, BOOL bEnable)
  47.      {
  48.      HWND hwndParent = WinQueryWindow (hwnd, QW_PARENT, FALSE) ;
  49.      HWND hwndMenu   = WinWindowFromID (hwndParent, FID_MENU) ;
  50.  
  51.      WinSendMsg (hwndMenu, MM_SETITEMATTR, MPFROM2SHORT(iMenuItem, TRUE),
  52.                  MPFROM2SHORT(MIA_DISABLED, bEnable ? 0 : MIA_DISABLED)) ;
  53.      }
  54.  
  55. VOID PaintWindow (HWND hwnd, SHORT iStatus, SHORT iRep, LONG lTime)
  56.      {
  57.      static CHAR *szMessage [3] = { "Ready", "Working ...",
  58.                                     "%d repetitions in %ld msec." } ;
  59.      CHAR        szBuffer [60] ;
  60.      HPS         hps ;
  61.      RECTL        rc ;
  62.  
  63.      hps = WinBeginPaint (hwnd, NULL, NULL) ;
  64.      GpiErase (hps) ;
  65.  
  66.      WinQueryWindowRect (hwnd, &rc) ;
  67.  
  68.      sprintf (szBuffer, szMessage [iStatus], iRep, lTime) ;
  69.  
  70.      WinDrawText (hps, -1, szBuffer, &rc, 0L, 0L, DT_TEXTATTRS | DT_CENTER | 
  71.          DT_VCENTER) ;
  72.      WinEndPaint (hps) ;
  73.      }
  74.  
  75. #endif
  76.  
  77.