summaryrefslogtreecommitdiff
path: root/src/env.h
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-01-20 23:25:53 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2020-02-04 03:33:21 -0500
commitdd4bd5b17ddedcaf64df09f7a10d34267b8834c3 (patch)
tree3e7d7ced274d7279070b0aebf84b0b8f889dc9a2 /src/env.h
parent2d4216a4f040f157b710eb0132f4049b4d69bddb (diff)
shift+right click for shell menu
Diffstat (limited to 'src/env.h')
-rw-r--r--src/env.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/env.h b/src/env.h
index 16f8039e..5c7492c6 100644
--- a/src/env.h
+++ b/src/env.h
@@ -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
//