home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / msj / msjv3_2 / bigjob.h next >
Encoding:
C/C++ Source or Header  |  1989-03-02  |  2.3 KB  |  88 lines

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