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.

45 lines
674 B

  1. #include "precomp.h"
  2. #pragma hdrstop
  3. #include "extimer.h"
  4. CExclusiveTimer::CExclusiveTimer(void)
  5. : m_nTimerId(0),
  6. m_hWnd(NULL)
  7. {
  8. }
  9. CExclusiveTimer::~CExclusiveTimer(void)
  10. {
  11. Kill();
  12. }
  13. void CExclusiveTimer::Kill(void)
  14. {
  15. if (m_hWnd && m_nTimerId)
  16. {
  17. KillTimer( m_hWnd, m_nTimerId );
  18. m_hWnd = NULL;
  19. m_nTimerId = 0;
  20. }
  21. }
  22. void CExclusiveTimer::Set( HWND hWnd, UINT nTimerId, UINT nMilliseconds )
  23. {
  24. Kill();
  25. m_hWnd = hWnd;
  26. m_nTimerId = nTimerId;
  27. if (m_hWnd && m_nTimerId)
  28. {
  29. SetTimer( m_hWnd, m_nTimerId, nMilliseconds, NULL );
  30. }
  31. }
  32. UINT CExclusiveTimer::TimerId(void) const
  33. {
  34. return m_nTimerId;
  35. }