Leaked source code of windows server 2003
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.

42 lines
822 B

  1. #include <windows.h>
  2. /////////////////////////////////////////////////////////////////////////////
  3. // CNewCursor
  4. class CNewCursor
  5. {
  6. // Constructors
  7. public:
  8. CNewCursor(LPCTSTR pszID = NULL)
  9. { m_hCursor = NULL; Push(pszID); }
  10. CNewCursor(UINT nID)
  11. { m_hCursor = NULL; Push(nID); }
  12. ~CNewCursor()
  13. { Pop(); }
  14. // Operations
  15. public:
  16. void Push(LPCTSTR pszID)
  17. {
  18. Pop();
  19. if (pszID != NULL)
  20. m_hCursor = SetCursor(LoadCursor(NULL, pszID));
  21. }
  22. void Push(UINT nID)
  23. { Push(MAKEINTRESOURCE(nID)); }
  24. void Pop()
  25. {
  26. if (m_hCursor != NULL)
  27. SetCursor(m_hCursor);
  28. m_hCursor = NULL;
  29. }
  30. // Attributes
  31. protected:
  32. // implementation data helpers
  33. HCURSOR m_hCursor;
  34. };