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.

48 lines
1.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: cscutils.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _INC_CSCVIEW_CSCUTILS_H
  11. #define _INC_CSCVIEW_CSCUTILS_H
  12. //-----------------------------------------------------------------------------
  13. // class CscFindHandle
  14. //-----------------------------------------------------------------------------
  15. //
  16. // Trivial class to ensure cleanup of FindFirst/FindNext handle.
  17. //
  18. class CscFindHandle
  19. {
  20. public:
  21. explicit CscFindHandle(HANDLE hFind)
  22. : m_hFind(hFind) { }
  23. ~CscFindHandle(void)
  24. {
  25. if (IsValidHandle())
  26. CSCFindClose(m_hFind);
  27. }
  28. operator HANDLE() const
  29. { return m_hFind; }
  30. bool IsValidHandle(void) const
  31. { return (INVALID_HANDLE_VALUE != m_hFind); }
  32. HANDLE Handle(void) const
  33. { return m_hFind; }
  34. private:
  35. HANDLE m_hFind;
  36. };
  37. #endif //_INC_CSCVIEW_CSCUTILS_H