#pragma once #include "powertoys_events.h" #include "system_menu_helper.h" #include #include #include #include #include #include #include struct PowertoyModuleDeleter { void operator()(PowertoyModuleIface* module) const { if (module) { powertoys_events().unregister_system_menu_action(module); powertoys_events().unregister_receiver(module); module->destroy(); } } }; struct PowertoyModuleDLLDeleter { using pointer = HMODULE; void operator()(HMODULE handle) const { FreeLibrary(handle); } }; class PowertoyModule { public: PowertoyModule(PowertoyModuleIface* module, HMODULE handle); inline PowertoyModuleIface* operator->() { return module.get(); } json::JsonObject json_config() const; private: std::unique_ptr handle; std::unique_ptr module; }; PowertoyModule load_powertoy(const std::wstring& filename); std::unordered_map& modules();