Move icon_enum_callback to separate function

This commit is contained in:
OPNA2608 2022-04-09 12:48:19 +02:00
parent 194ba95633
commit d5b07aa347

View file

@ -1331,6 +1331,14 @@ inline std::string internal::file_dialog::select_folder_vista(IFileDialog *ifd,
// notify implementation // notify implementation
#if _WIN32
inline BOOL WINAPI icon_enum_callback(HMODULE hModule, LPCTSTR lpType, LPTSTR lpName, LONG_PTR lParam)
{
((NOTIFYICONDATAW *)lParam)->hIcon = ::LoadIcon(GetModuleHandle(nullptr), lpName);
return false;
};
#endif
inline notify::notify(std::string const &title, inline notify::notify(std::string const &title,
std::string const &message, std::string const &message,
icon _icon /* = icon::info */) icon _icon /* = icon::info */)
@ -1383,14 +1391,8 @@ inline notify::notify(std::string const &title,
/* case icon::info: */ default: nid->dwInfoFlags = NIIF_INFO; break; /* case icon::info: */ default: nid->dwInfoFlags = NIIF_INFO; break;
} }
ENUMRESNAMEPROC icon_enum_callback = [](HMODULE, LPCTSTR, LPTSTR lpName, LONG_PTR lParam) WINAPI -> BOOL
{
((NOTIFYICONDATAW *)lParam)->hIcon = ::LoadIcon(GetModuleHandle(nullptr), lpName);
return false;
};
nid->hIcon = ::LoadIcon(nullptr, IDI_APPLICATION); nid->hIcon = ::LoadIcon(nullptr, IDI_APPLICATION);
::EnumResourceNames(nullptr, RT_GROUP_ICON, icon_enum_callback, (LONG_PTR)nid.get()); ::EnumResourceNames(nullptr, RT_GROUP_ICON, (ENUMRESNAMEPROC)icon_enum_callback, (LONG_PTR)nid.get());
nid->uTimeout = 5000; nid->uTimeout = 5000;