CGlobalAtom.h 303 B

123456789101112131415161718192021
  1. #pragma once
  2. #include <windows.h>
  3. class CGlobalAtom
  4. {
  5. public:
  6. CGlobalAtom(LPCWSTR name)
  7. {
  8. prop = GlobalAddAtomW(name);
  9. }
  10. ~CGlobalAtom()
  11. {
  12. if (prop)
  13. GlobalDeleteAtom(prop);
  14. prop=0;
  15. }
  16. operator ATOM() { return prop; }
  17. operator LPCWSTR() { return (LPCWSTR) prop; }
  18. private:
  19. ATOM prop;
  20. };