diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-01-20 23:25:53 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-02-04 03:33:21 -0500 |
| commit | dd4bd5b17ddedcaf64df09f7a10d34267b8834c3 (patch) | |
| tree | 3e7d7ced274d7279070b0aebf84b0b8f889dc9a2 /src/env.h | |
| parent | 2d4216a4f040f157b710eb0132f4049b4d69bddb (diff) | |
shift+right click for shell menu
Diffstat (limited to 'src/env.h')
| -rw-r--r-- | src/env.h | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -30,6 +30,23 @@ struct DesktopDCReleaser using DesktopDCPtr = std::unique_ptr<HDC, DesktopDCReleaser>; +// used by HMenuPtr, calls DestroyMenu() as the deleter +// +struct HMenuFreer +{ + using pointer = HMENU; + + void operator()(HMENU h) + { + if (h != 0) { + ::DestroyMenu(h); + } + } +}; + +using HMenuPtr = std::unique_ptr<HMENU, HMenuFreer>; + + // used by LibraryPtr, calls FreeLibrary as the deleter // struct LibraryFreer @@ -94,6 +111,23 @@ template <class T> using LocalPtr = std::unique_ptr<T, LocalFreer<T>>; +// used by the CoTaskMemPtr, calls CoTaskMemFree() as the deleter +// +template <class T> +struct CoTaskMemFreer +{ + using pointer = T; + + void operator()(T p) + { + ::CoTaskMemFree(p); + } +}; + +template <class T> +using CoTaskMemPtr = std::unique_ptr<T, CoTaskMemFreer<T>>; + + // creates a console in the constructor and destroys it in the destructor, // also redirects standard streams // |
