Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.5 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: timer.h
  6. * Content: Timer class - lifted from MSDN
  7. *
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 07/16/99 rodtoll Created
  12. * 01/14/2000 rodtoll Updated to use DWORD_PTR to allow proper 64-bit operation
  13. * 01/08/2001 rodtoll WINBUG #271079 - Pointer being sliced by cast through a DWORD
  14. *
  15. ***************************************************************************/
  16. //
  17. // Timer.h
  18. //
  19. // This file is from the MSDN, Visual Studuio 6.0 Edition
  20. //
  21. // Article:
  22. // Streaming Wave Files With DirectSound
  23. //
  24. // Author:
  25. // Mark McCulley, Microsoft Corporation
  26. //
  27. #ifndef _INC_TIMER
  28. #define _INC_TIMER
  29. // Constants
  30. #ifndef SUCCESS
  31. #define SUCCESS TRUE // Error returns for all member functions
  32. #define FAILURE FALSE
  33. #endif // SUCCESS
  34. typedef BOOL (*TIMERCALLBACK)(DWORD_PTR);
  35. // Classes
  36. // Timer
  37. //
  38. // Wrapper class for Windows multimedia timer services. Provides
  39. // both periodic and one-shot events. User must supply callback
  40. // for periodic events.
  41. //
  42. class Timer
  43. {
  44. public:
  45. Timer (void);
  46. ~Timer (void);
  47. BOOL Create (UINT nPeriod, UINT nRes, DWORD_PTR dwUser, TIMERCALLBACK pfnCallback);
  48. protected:
  49. static void CALLBACK TimeProc(UINT uID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
  50. TIMERCALLBACK m_pfnCallback;
  51. DWORD_PTR m_dwUser;
  52. UINT m_nPeriod;
  53. UINT m_nRes;
  54. UINT m_nIDTimer;
  55. };
  56. #endif // _INC_TIMER